How to print a specific row of a pandas DataFrame?

前端 未结 5 1307
陌清茗
陌清茗 2021-01-29 23:01

I have a massive dataframe, and I\'m getting the error:

TypeError: (\"Empty \'DataFrame\': no numeric data to plot\", \'occurred at index 159220\')

5条回答
  •  自闭症患者
    2021-01-29 23:37

    When you call loc with a scalar value, you get a pd.Series. That series will then have one dtype. If you want to see the row as it is in the dataframe, you'll want to pass an array like indexer to loc.

    Wrap your index value with an additional pair of square brackets

    print(df.loc[[159220]])
    

提交回复
热议问题