使用python使用最小/最大/平均绘制csv文件

时间:2018-08-24 23:42:24

标签: python pandas csv matplotlib

我有一个csv文件,每100秒测量一次。 进行了5次不同的测量。 我正在寻找一个简单的解决方案,该方法如何使用每个测量点的平均值和最小值,最大值创建一条线图,并用Python来标出该条。 CSV文件如下所示:

0,0.000622,0.000027,0.000033,0.000149,0.000170 100,0.014208,0.017168,0.017271,0.015541,0.027972 200,0.042873,0.067629,0.035837,0.033160,0.018006 300,0.030700,0.018563,0.016640,0.020294,0.020338 400,0.018906,0.016507,0.015445,0.018734,0.017593 500,0.027344,0.045668,0.015214,0.016045,0.015520 600,0.021233,0.098135,0.016511,0.015892,0.018342

第一列以秒为单位。

也许有人可以帮我一个快速的想法。

预先感谢

--------------------添加

我到目前为止所拥有的:

import pandas as pd

input_df = pd.read_csv(input.csv")
input_df['max_value'] = input_df.iloc[:,1:6].max(axis=1)
input_df['min_value'] = input_df.iloc[:,1:6].min(axis=1)
input_df['avg_value'] = input_df.iloc[:,1:6].mean(axis=1)

input_df.plot(x=input_df["0"], y='avg_value')

如何添加误差线(最小值,最大值)

1 个答案:

答案 0 :(得分:1)

您可以使用matplotlib。对于您的问题:

y