KeyError: 0 when accessing value in pandas series

前端 未结 1 1900
半阙折子戏
半阙折子戏 2021-01-17 11:50

In my script I have df[\'Time\'] as shown below.

497   2017-08-06 11:00:00
548   2017-08-08 15:00:00
580   2017-08-10 04:00:00
646   2017-08-12 23:00:00
Name         


        
相关标签:
1条回答
  • 2021-01-17 12:36

    You're looking for df.iloc.

    df['Time'].iloc[0]
    

    df['Time'][0] would've worked if your series had an index beginning from 0

    And if need scalar only use Series.iat:

    df['Time'].iat[0]
    
    0 讨论(0)
提交回复
热议问题