Reputation: 1
I have a data set as below:
I want to remove 'Undecided'
from my ['Grad Intention']
column. For this, I created a copy DataFrame and using the code as follows:
df_copy=df_copy.drop([df_copy['Grad Intention'] =='Undecided'], axis=1)
However, this is giving me an error.
How can I remove the row with 'Undecided'
? Also, what's wrong with my code?
Upvotes: 0
Views: 7204
Reputation: 344
you could simply use:
df = df[df['Grad Intention'] != 'Undecided']
or
df.drop(df[df['Grad Intention'] == 'Undecided'].index, inplace = True)
Upvotes: 1