diff --git a/api/api_v1/endpoints/query.py b/api/api_v1/endpoints/query.py index 79f3f3c..423f20e 100644 --- a/api/api_v1/endpoints/query.py +++ b/api/api_v1/endpoints/query.py @@ -1227,6 +1227,9 @@ async def scatter_model( bins.append(v) if 'float' in str(df.dtypes['va']): df['va'] = df['va'].astype(int) + if 'list' in str(type(df['va'][0])): + f = lambda x: x[0] + df['va'] = df['va'].map(f) # 这是分组的 for key, tmp_df in df.groupby('va'): @@ -1271,6 +1274,9 @@ async def scatter_model( } labels = [str(i) for i in sorted(df['values'].unique())] resp['label'] = labels + if 'list' in str(type(df['va'][0])): + f = lambda x: x[0] + df['va'] = df['va'].map(f) for key, tmp_df in df.groupby(['va']): total = len(tmp_df) if res['time_particle'] == 'total':