iterrows cannot iterate over DataFrame Eror: touple object has no attribute “A”

前端 未结 1 1020
北荒
北荒 2021-01-28 12:35

When I try to iterate over a dataframe, somehow dtype is changed.

dates = pd.date_range(\'20130101\',periods=6)
df = pd.DataFrame(np.random.randn(6,4),index=dat         


        
相关标签:
1条回答
  • 2021-01-28 13:20

    itterrows creates a tuple, so try this:

    for pos, row in df.iterrows():
        print (row.A)
    
    0 讨论(0)
提交回复
热议问题