I have below csv file. And i am reading this csv file using pandas dataframe.
Input:
Now i am trying to fetch if 2 columns city != null and state != null and country == null then it will return those row only.
Output
Code
def fieldValidation(df):
try:
nan_rows = df[df['city'].notnull(), df['state'].notnull(), df['country'].isnull()]
print(nan_rows)
except Exception as error:
print(error)
Can anyone tell me where i am doing wrong or how can i achive this?