Skip to content
Advertisement

Null/duplicate check in a column based on another column filter

I am working on pandas with the below requierment

enter image description here

I need to check the below conditions if criteria is A, then m shouldn’t be null if criteria is B then n shouldn’t be null

I wrote the below code for it

JavaScript

or

JavaScript

but both are not giving correct result

I have also tried

JavaScript

but this giving the columns without null..

I need to check if there are any null values exist in m column if A is selected from criteria.

Any help would be appreciated

Advertisement

Answer

Use Series.notna for test not missing values, if need chain another condition use | for bitwise OR:

JavaScript

If no values are empty strings:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement