How to simplify or break down the super long IF Condition in Python pandas?
my_dataframes = {'d1': d1, 'd2': d2,'d3': d3}
good_dataframes = []
for df_name, df in my_dataframes.items():
if ((df.loc[1:4, 'test'] <= 6).all
and (df.loc[5:9, 'dif'] < 9).all()) or ((df.loc[1:5, 'test'] <= 6).all
and (df.loc[5:8, 'dif'] < 8).all()) or ((df.loc[1:8, 'test'] <= 6).all
and (df.loc[5:8, 'dif'] < 9).all()):
good_dataframes.append(df_name)
the challenge for me is put the right indent
Aucun commentaire:
Enregistrer un commentaire