iterrows cannot iterate over DataFrame Eror: touple object has no attribute “A”
问题 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=dates,columns=list('ABCD')) df A B C D 2013-01-01 -1.328046 -0.545127 -0.033153 1.190336 2013-01-02 -0.549147 0.447161 1.179931 0.397521 2013-01-03 -0.106707 -0.327574 -0.933817 -1.032949 2013-01-04 -0.519988 -1.007374 -0.794482 -1.757222 2013-01-05 -0.739735 1.220599 -1.387994 -0.116178 2013-01-06 0.262876 -0.679471 -0.568768 -0.277880 now