循环遍历pandas数据帧

时间:2017-07-19 06:42:34

标签: python pandas for-loop

我正在试图弄清楚如何遍历“熊猫”#39; Python中的数据框。

以下是我尝试阅读的CSV文件: csv file

这是我到目前为止的Python代码;请帮我确定一下我缺少的东西:

import pandas as pd
import matplotlib.pyplot as plt

data = pd.read_csv("E://Test1.csv")

data_org = data[data['Distance']>1]

Distance = data_org.iloc[:,0]
Temperature=data_org.iloc[:,1:]

#Label for legend with timestamp  ---> wont print date
Date = data_org.iloc[:,1]
print (Date)

for i in Temperature:
    print (i)
    Temperature[i]= Temperature[:,i:]   --> wont iterate

 for p in Temperature:
    plt.plot(x,y, 'b')

    plt.xlabel('Distance [m]')
    plt.ylabel('Temperature [oC]')
    plt.legend(loc='lower right')

    #Changing Name for each Iteration
    plt.savefig('E://%s.png' % Date [i]) 

0 个答案:

没有答案