I have a massive dataframe, and I'm getting the error:
TypeError: ("Empty 'DataFrame': no numeric data to plot", 'occurred at index 159220')
I've already dropped nulls, and checked dtypes for the DataFrame so I have no guess as to why it's failing on that row.
How do I print out just that row (at index 159220) of the data frame?
Thanks
This question is related to
python
python-3.x
pandas
indexing
To print a specific row we have couple of pandas method
loc
- It only get label i.e column name or Featuresiloc
- Here i stands for integer, actually row number ix
- It is a mix of label as well as integerHow to use for specific row
loc
df.loc[row,column]
For first row and all column
df.loc[0,:]
For first row and some specific column
df.loc[0,'column_name']
iloc
For first row and all column
df.iloc[0,:]
For first row and some specific column i.e first three cols
df.iloc[0,0:3]
Use ix
operator:
print df.ix[159220]
Sounds like you're calling df.plot()
. That error indicates that you're trying to plot a frame that has no numeric data. The data types shouldn't affect what you print()
.
Use print(df.iloc[159220])
If you want to display at row=159220
row=159220
#To display in a table format
display(res.loc[row:row])
display(res.iloc[row:row+1])
#To display in print format
display(res.loc[row])
display(res.iloc[row])
Source: Stackoverflow.com