Tlaloc-ES
Tlaloc-ES

Reputation: 5282

How to can I remove the nlargest element?

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

Answers (1)

usenk
usenk

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

Related Questions