Normal validations I am able to do using
m1 = (df[some_column] == some_value )
m2 = ( df[some_column].isin(some_list_of_values) )# This check whether the value of the column is one of the values in the list
m3 = ( df[some_column].str.contains() # You can use it the same as str.contains())
m4 = (df[some_column].str.isdigit()) # Same usage as str.isdigit(), check whether string is all digits, need to make sure column type is string in advance
Then to get the dataframe after all the above validations-
df = df[m1 & m2 & m3 & m4]
When I print (df[some_column] == some_value ) I get
0 False
1 True
2 True
I want to validate something in a function using if else, like ,
if min_group_price is True , then both single_male single_female needs to be True
If min_group_price is False , then no check(Final result should be True)
My test data is something like ,
min_group_price single_male single_female
0 1.0 2.0 3.0
1 NaN NaN NaN
2 1.0 2.0 NaN
3 NaN 2.0 NaN
4 0.0 NaN 4.0
5 NaN NaN 2.0
In this as per the above logic, index 0,1,3,5 should be True.
I dont want to iterrows . How can I do this?