1.优化分组项问题
This commit is contained in:
parent
af99d85ea0
commit
6d12abe4f3
@ -1,3 +1,4 @@
|
||||
import ast
|
||||
import datetime
|
||||
from collections import defaultdict
|
||||
import mimetypes
|
||||
@ -430,7 +431,7 @@ async def event_model(
|
||||
appgb = str(gb).replace("'", '')
|
||||
groups.append(appgb)
|
||||
item['groups'] = groups
|
||||
|
||||
item['groupby']=groupby
|
||||
item['values'] = np.array(item['values'])[sort_key].tolist()
|
||||
item['sum'] = np.array(item['sum'])[sort_key].tolist()
|
||||
item['avg'] = np.array(item['avg'])[sort_key].tolist()
|
||||
@ -804,7 +805,11 @@ async def retention_model(request: Request,
|
||||
for _, items in new_summary_valuess.items():
|
||||
for key in ['p', 'n', 'p_outflow', 'n_outflow']:
|
||||
items[key].extend(['-'] * (retention_length - len(items[key])))
|
||||
|
||||
groupby_data = []
|
||||
for i in new_summary_valuess.keys():
|
||||
ac = ast.literal_eval(i)
|
||||
ab = [str(ii) for ii in ac]
|
||||
groupby_data.append(ab)
|
||||
resp = {
|
||||
'summary_values': new_summary_valuess,
|
||||
# 'values': values,
|
||||
@ -814,8 +819,9 @@ async def retention_model(request: Request,
|
||||
'filter_item': filter_item,
|
||||
'start_date': res['start_date'],
|
||||
'end_date': res['end_date'],
|
||||
'time_particle': res['time_particle']
|
||||
|
||||
'time_particle': res['time_particle'],
|
||||
'groupby':[i['columnName'] for i in groupby_list],
|
||||
'groupby_data':groupby_data
|
||||
}
|
||||
return schemas.Msg(code=0, msg='ok', data=resp)
|
||||
|
||||
@ -1672,6 +1678,12 @@ async def scatter_model(
|
||||
if group_label:
|
||||
for name, idx in group_label.items():
|
||||
resp['biaotou'].insert(idx, name)
|
||||
groupby_data = []
|
||||
for i in resp['list'].keys():
|
||||
ac = ast.literal_eval(i)
|
||||
ab = [str(ii) for ii in ac]
|
||||
groupby_data.append(ab)
|
||||
resp['groupby_data']=groupby_data
|
||||
return schemas.Msg(code=0, msg='ok', data=resp)
|
||||
else:
|
||||
# 离散数字
|
||||
@ -1773,6 +1785,12 @@ async def scatter_model(
|
||||
if group_label:
|
||||
for name, idx in group_label.items():
|
||||
resp['biaotou'].insert(idx, name)
|
||||
groupby_data = []
|
||||
for i in resp['list'].keys():
|
||||
ac = ast.literal_eval(i)
|
||||
ab = [str(ii) for ii in ac]
|
||||
groupby_data.append(ab)
|
||||
resp['groupby_data']=groupby_data
|
||||
return schemas.Msg(code=0, msg='ok', data=resp)
|
||||
else:
|
||||
return schemas.Msg(code=-9, msg='没有添加分组项', data='')
|
||||
|
Loading…
Reference in New Issue
Block a user