0

I have to filter a dataframe df_data that I created from an excel file and I have to filter it by 3 conditions on 3 different columns (2 string and 1 Timestamp).

I thought on something like this and it works:

df_final = df_data.loc[df_data['Column1'].str.contains('Change',case=False, na=False)]
df_final = df_final.loc[df_final['Column2'].str.contains('SEC',case=False, na=False)]
df_final = df_final[df_final['Date'].dt.normalize() == timestamptodayn]

I know I can do it with lists and index in a for loop but I'm looking for a no error way with pandas. Can I improve it in some way?

Thanks

0 Answers0