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