From dc3844978a2d6a8e98333f04b4f8111273f6cd08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80=C3=AE=C3=97=C3=9A=C3=95=C3=B1?= Date: Fri, 19 Aug 2022 19:08:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=88=86=E6=9E=90h5=E6=BC=8F?= =?UTF-8?q?=E6=96=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/query.py | 1 + models/behavior_analysis.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/api_v1/endpoints/query.py b/api/api_v1/endpoints/query.py index a3aa5c6..1034160 100644 --- a/api/api_v1/endpoints/query.py +++ b/api/api_v1/endpoints/query.py @@ -1213,6 +1213,7 @@ async def funnel_model( df[group_str] = df[group_str].astype(int) step_list = [str(i) for i in sorted(df[group_str].unique())] dict_k = {} + df['values'] = 1 for k, nedf in df.groupby("date"): ste_k = {} for kk, ste_df in nedf.groupby(group_str): diff --git a/models/behavior_analysis.py b/models/behavior_analysis.py index 48787c8..b5e4a91 100644 --- a/models/behavior_analysis.py +++ b/models/behavior_analysis.py @@ -1020,8 +1020,8 @@ ORDER BY level sql = str(qry.compile(compile_kwargs={"literal_binds": True})) print(sql) - sqla = sql.replace('SELECT', f'SELECT {analysis}, ', 1) - sqlb = sqla.replace('GROUP BY', f'GROUP BY {analysis}, ', 1) + sqla = sql.replace('SELECT', f'SELECT `#account_id`, {analysis}, ', 1) + sqlb = sqla.replace('GROUP BY', f'GROUP BY `#account_id`, {analysis}, ', 1) sqlc = sqlb.replace('WHERE', f'WHERE {analysis} is not null AND ', 1) print(sqlc) return {