I have a dataframe and want to only show columns with headers containing a particular string(s).
df.loc[:,df.columns.str.contains(['BB','TP'])]
So this would only show columns that contain BB or TP. This doesn't work for 2 conditions however.
I have a dataframe and want to only show columns with headers containing a particular string(s).
df.loc[:,df.columns.str.contains(['BB','TP'])]
So this would only show columns that contain BB or TP. This doesn't work for 2 conditions however.