1.优化漏斗分析用int类型分组出错的问题
This commit is contained in:
parent
831c923e6f
commit
54ce80f1b0
@ -392,8 +392,8 @@ async def event_model(
|
||||
if item.get('groups'):
|
||||
item['groups'] = np.array(item['groups'])[sort_key].tolist()
|
||||
groups = []
|
||||
groupbys=analysis.event_view.get('groupBy')
|
||||
groupby_list=[i['columnName'] for i in groupbys]
|
||||
# groupbys=analysis.event_view.get('groupBy')
|
||||
# groupby_list=[i['columnName'] for i in groupbys]
|
||||
for gitem in item['groups']:
|
||||
gb = []
|
||||
if '(' in gitem or '[' in gitem:
|
||||
@ -411,15 +411,15 @@ async def event_model(
|
||||
gb.insert(idx, name)
|
||||
|
||||
# 去掉分组表现里面的''
|
||||
# appgb = str(gb).replace("'", '')
|
||||
# groups.append(appgb)
|
||||
# item['groups'] = groups
|
||||
#修改后的方案
|
||||
by_dict={}
|
||||
for i in range(len(gb)):
|
||||
by_dict[groupby_list[i]]=gb[i]
|
||||
groups.append(by_dict)
|
||||
appgb = str(gb).replace("'", '')
|
||||
groups.append(appgb)
|
||||
item['groups'] = groups
|
||||
#修改后的方案
|
||||
# by_dict={}
|
||||
# for i in range(len(gb)):
|
||||
# by_dict[groupby_list[i]]=gb[i]
|
||||
# groups.append(by_dict)
|
||||
# item['groups'] = groups
|
||||
else:
|
||||
if group_label:
|
||||
groups = []
|
||||
@ -733,6 +733,10 @@ async def retention_model(request: Request,
|
||||
summary_valuess.pop("['均值']")
|
||||
new_summary_valuess = {}
|
||||
for group_key, group_data in summary_valuess.items():
|
||||
# 单个分组
|
||||
if len(true_group) <= 1:
|
||||
key_list = [group_key]
|
||||
else:
|
||||
key_list = eval(group_key)
|
||||
true_key = [] # 重新定义后的分组
|
||||
for index, value in enumerate(key_list):
|
||||
@ -1168,7 +1172,7 @@ async def funnel_model(
|
||||
# tmp['p2'].append(round(v*100 / tmp_df.loc[i - 1, 'values'], 2))
|
||||
|
||||
_ = date_data.setdefault(key[0].strftime('%Y-%m-%d'), {})
|
||||
#_[key[1]] = tmp
|
||||
#[key[1]] = tmp
|
||||
title = (groupby or ['总体']) + cond_level
|
||||
resp = {'list': data_list,
|
||||
'date_data': date_data,
|
||||
|
Loading…
Reference in New Issue
Block a user