I have a dataframe df:
type rec_1 rec_2 rec_3 rec_4 rec_1_outlier rec_2_outlier rec_3_outlier rec_4_outlier
yellow 1 7 3 1 FALSE TRUE TRUE TRUE
red 3 11 2 5 FALSE TRUE FALSE FALSE
blue 5 2 1 6 TRUE FALSE FALSE FALSE
green 2 9 13 9 FALSE FALSE TRUE FALSE
I want to get separate dataframes per type where the _outlier columns are only false, but the rec columns are independent of each other and one column may be true and the other false.
So theoretically if I were to try
df_blue = df['type']=='blue' & df['rec_1_outlier']=='False' & df['rec_2_outlier']=='False' & df['rec_3_outlier']=='False' & df['rec_4_outlier']=='False'
This would might never select any rows because the _outlier columns might never all be false.
I have also thought about doing it one column at a time like this.
df_blue_rec_1 = df['type']=='blue' & df['rec_1_outlier']=='False'
df_blue_rec_2 = df['type']=='blue' & df['rec_2_outlier']=='False'
Then just appending the separate dataframes into one.
I have this feeling like there is a better way to accomplish this.