Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14126

Check if the group has NaN values

$
0
0

I have a dataframe and I would like to groupby by bq_market_id and then check if there is any NaN values in bq_back_price in each group if yes then True per group if no then False per group.

bq_selection_id bq_balance  bq_market_id  bq_back_price0         45094462     185.04       7278437           1.971         45094462     185.04       7278437           1.972         45094463     185.04       7278437           3.053         45094463     185.04       7278437           3.054         45094464     185.04       7278437           5.805         45094464     185.04       7278437           5.806         45094466     185.04       7278437         200.007         45094466     185.04       7278437         200.008         45094465     185.04       7278437            NaN9         45094465     185.04       7278437            NaN

How do i do this? I tried the following, but it did not work.

bb.groupby('bq_market_id')['bq_back_price'].isnull().any()

Viewing all articles
Browse latest Browse all 14126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>