From 7f96405a8c402bfdedd50c8c13342d12832c1a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= <250213850@qq.com> Date: Mon, 9 May 2022 10:26:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=88=86=E5=B8=83=E5=88=86?= =?UTF-8?q?=E6=9E=90=E4=B8=AD=E5=88=86=E7=BB=84=E9=A1=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=98=AF=E5=88=97=E8=A1=A8=E6=97=B6=E6=97=A0=E6=B3=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/query.py | 6 ++++++ 1 file changed, 6 insertions(+) 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':