I have a dataframe and want to split the dataframe into two based on multiple columns.
df should have all rows without null column and status yes. Rest should be on df_null
df = vehicle.csv
Status Country City Year
Yes USA New York 2001
Yes Canada 2001
Yes France Paris
No Rio 1843
No Germany Berlin 2008
Yes 2004
# df_null has all the rows with null in the three columns
df_null = df[~df[['Country', 'City', 'Year']].notnull().all(1)]
# df has all columns with not null and status = yes
df = df[df[['Country', 'City', 'Year']].notnull().all(1)]
df = df.loc[df['Status'] == 'Yes']
result = pd.concat([df, df_null])
Row with Germany isnt on result dataframe because its filtered out by Status = Yes
.