Reputation: 5282
Hi I am triying to delete the nlargest examples of a dataset but I don't know how do it.
I get the data with the following code:
df_ae.nlargest(30, 'minimum_nights')
And I want to delete because this are the outliers in the dataset, I don't want to use the formula that drops the particular percentage.
How can do delete this data?
Thanks
Upvotes: 2
Views: 878
Reputation: 116
One possible approach:
df_ae.drop(index=df_ae.nlargest(30, 'mininimum_nights').index, inplace=True)
Note that it's probably good to add option keep='all'
to your nlargest
.
Upvotes: 3