1
This commit is contained in:
parent
d30d98fb3d
commit
03aafe645d
@ -145,7 +145,8 @@ async def event_model(
|
||||
df = await ckdb.query_dataframe(sql)
|
||||
df.fillna(0, inplace=True)
|
||||
if df.shape[0] == 0:
|
||||
continue
|
||||
df = pd.DataFrame({'date':date_range,'values':0*len(date_range)})
|
||||
# continue
|
||||
# return schemas.Msg(code=0, msg='ok', data=[q])
|
||||
if item['time_particle'] == 'total':
|
||||
# for group, df_group in df.groupby(groupby):
|
||||
@ -198,7 +199,7 @@ async def event_model(
|
||||
if len(df) >= 2:
|
||||
q['chain_ratio'] = division((df.iloc[-1, 1] - df.iloc[-2, 1]) * 100, df.iloc[-2, 1], 2)
|
||||
if len(df) >= 8:
|
||||
q['wow'] = division((df.iloc[-1, 1] - df.iloc[-8, 1]) * 100 / df.iloc[-8, 1], 2) or 0
|
||||
q['wow'] = division((df.iloc[-1, 1] - df.iloc[-8, 1]) * 100, df.iloc[-8, 1], 2) or 0
|
||||
q['values'].append(df['values'].to_list())
|
||||
for last_value in df['values'].values[::-1]:
|
||||
if last_value > 0:
|
||||
|
Loading…
Reference in New Issue
Block a user