vendredi 10 février 2017

What does ~ mean in python program?

Vote count: 0

I have pandas data frame called log_data and I'm detecting outliers in the data frame using the code

 display(log_data[~((log_data[feature] >= Q1 - step) & (log_data[feature] <= Q3 + step))])

where

Q1 = np.percentile(log_data[feature],25)
    Q3 = np.percentile(log_data[feature],75)
    step = 1.5 * (Q3 - Q1)

Can anyone tell me what '~' is doing in the code

display(log_data[~((log_data[feature] >= Q1 - step) & (log_data[feature] <= Q3 + step))])

asked 41 secs ago

1 Answer

Vote count: 0

~ is for inverting boolean mask.

answered 4 secs ago

Let's block ads! (Why?)



What does ~ mean in python program?

Aucun commentaire:

Enregistrer un commentaire