danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

Any simple way to invert a boolean mask ? ("~" operator in Pandas)

Open Achuttarsing opened this issue 3 years ago • 0 comments

Hi ! First, thank you for your amazing work !

I would like to remove rows containing Na in a specific column of a DataFrame. I'm new to Danfojs so maybe I'm missing something... There is no notNa() operator so I'm trying df.query( df['specific_column'].isNa().eq(false) ) but it gives an error.

I'm wondering if there is an easy way to do this.

I'm not thinking about a notNa() function, but more generally a way to revert a boolean mask like the tilde (~) operator in Pandas. This operator means bitwise not, inverting False to True and True to False.

Ex : df[~df["name"].str.contains("ick")] selects all the rows whose 'name' column does not contain "ick".

Thank you for your help

Achuttarsing avatar May 09 '22 21:05 Achuttarsing