0

so I have a data set that i work in Jupyter Notebook. Its like this:

Riding Filipino Population
0 Eglinton-Lawrence 12421.750
1 York Centre 17639.200
2 Don Valley East 7267.260
3 Scarborough Centre 14468.950
4 Scarborough Southwest 10288.025
5 Scarborough-Rouge Park 9434.385
6 Scarborough-Guildwood 8594.775

Every time I've tried to drop the Row (0) Zero, it will return with, KeyError: '[0] not found in axis'.

To drop the row, I use this following

pop_filipino2_DF_with_percent.drop([0], axis=1, inplace=True)

I tried to create a new dataframe, df_filipino2_clean = pop_filipino2_DF_with_percent.drop([0],axis=1,inplace=True), but it also return with --> KeyError: '[0] not found in axis'.

The question is, how to drop the first row (0)?

Chris
  • 29,127
  • 3
  • 28
  • 51

1 Answers1

0

The reason why it's not working is because you're attempting to drop a column. The correct way to do it is:

pop_filipino2_DF_with_percent.drop([0], inplace=True)
dedede
  • 197
  • 11