diff --git a/api/api_v1/endpoints/query.py b/api/api_v1/endpoints/query.py index 496cde9..79f3f3c 100644 --- a/api/api_v1/endpoints/query.py +++ b/api/api_v1/endpoints/query.py @@ -1015,9 +1015,9 @@ async def scatter_model( if df.empty: return schemas.Msg(code=-9, msg='无数据', data=None) if 'list' in str(type(df['values'][0])): - f=lambda x:x[0] - df['values']=df['values'].map(f) - + # f=lambda x:x[0] + # df['values']=df['values'].map(f) + df = df.explode("values").reset_index(drop=True) #df['values']=df['values'].astype(str) df.fillna(0, inplace=True) #转换数据类型为int @@ -1190,8 +1190,9 @@ async def scatter_model( if df.empty: return schemas.Msg(code=-9, msg='无数据', data=None) if 'list' in str(type(df['values'][0])): - f = lambda x: x[0] - df['values'] = df['values'].map(f) + # f = lambda x: x[0] + # df['values'] = df['values'].map(f) + df = df.explode("values").reset_index(drop=True) df.fillna(0, inplace=True) # 转换数据类型为int df['values'] = df['values'].astype(int) diff --git a/core/config.py b/core/config.py index 50542e5..c19f647 100644 --- a/core/config.py +++ b/core/config.py @@ -295,6 +295,16 @@ class Settings(BaseSettings): 'id': 'not in', 'title': '不是' }, + ], + 'array': [ + { + 'id': 'is not null', + 'title': '有值' + }, + { + 'id': 'is null', + 'title': '无值' + } ] } ARITHMETIC = { @@ -302,6 +312,7 @@ class Settings(BaseSettings): '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, + #'%': lambda x, y:(x)-int(x/y)*(y) 取模用 } PROPHET_TIME_GRAIN_MAP = { @@ -389,7 +400,7 @@ class Settings(BaseSettings): class Debug(Settings): - MDB_HOST: str = '10.0.0.7' + MDB_HOST: str = '10.0.0.9' MDB_PORT: int = 27017 MDB_USER: str = 'root' MDB_PASSWORD: str = 'iamciniao' diff --git a/models/behavior_analysis.py b/models/behavior_analysis.py index 98a0c66..ca2e780 100644 --- a/models/behavior_analysis.py +++ b/models/behavior_analysis.py @@ -611,7 +611,7 @@ ORDER BY level event = self.events[0] event_name = event['eventName'] analysis = event['analysis'] - if analysis == 'list_distinct': + if analysis in ['list_distinct',"set_distinct","ele_distinct"]: analysis = 'max' e_account_id_col = getattr(self.event_tbl.c, '#account_id').label('uid') u_account_id_col = getattr(self.user_tbl.c, '#account_id')