Filter DataFrame Rows Using In and Not In Equivilant
Python
1| sex = ['male'] 2| 3| # filter dataframe to include only male values in the sex column 4| males = df[df['Sex'].isin(sex)] 5| 6| # filter dataframe to include only values that are not male in 7| # the sex column 8| females = df[~df['Sex'].isin(sex)]
142
127
122
115