我设计了一个简单的绘图仪,我已经清理了数据,然后按日期排序,但Y轴没有缩放
df_fig = make_subplots(rows=1, cols=2)
df_fig.add_trace(go.Scatter(x=df['Date'], y=df['G1_1'], mode='lines+markers',
marker_size=5, line_width=1, customdata=df, name='G1_1'),
row=1, col=1)
df_fig .add_trace(go.Scatter(x=df['Date'],
y=FSC3_RESERVE_df_12M['Reserve G1_2'], mode='lines+markers',
marker_size=5, line_width=1, customdata=df, name='G1_2'),
row=1, col=1)
df_fig .add_trace(go.Scatter(x=df['Date'], y=df['G2_1'], mode='lines+markers',
marker_size=5, line_width=1, customdata=df, name='G2_1'),
row=1, col=2)
df_fig.add_trace(go.Scatter(x=df['Datum HP'], y=df['G2_2'], mode='lines+markers',
marker_size=5, line_width=1, customdata=df, name='G2_2'),
row=1, col=2)
#df.update_yaxes(range=[0, 1000])
df_fig.show()
Y轴完全乱了
以下是dataframe的摘录:
Date G1_1
2022-01-25 2.079
2022-01-25 2.577
2022-01-25 1.635
2022-01-25 0.818
2022-01-26 2.658
2022-01-26 0.818
2022-01-26 1.976
... ....
2323-03-22
2323-03-22
2323-03-22 .....
2323-03-23
2323-03-24
其他列也是如此
1条答案
按热度按时间yfwxisqw1#
虽然我:格式化了数据类型,它不起作用,所以。这可能是因为上面一行中的转换只是为了比较,但原始DataFrame中的列值仍然存储为对象。要将DataFrame中的列转换为浮点值,可以使用“astype”方法,如下所示: