I have a dataframe with columns similar to
Run Date1 Date2 Date3 A.0 A.1 A.2 B.0 B.1 B.2....
I want to keep the Run and Date columns but only select the columns that contain A, B, etc. So the output should look something like
Run Date1 Date2 Date3 A.0 A.1 A.2
Using filter(like=A, axis=1) only gives me columns with A and not the run and date columns
I tried
df.iloc[:, [0,1,2,3,df.columns.get_loc(df.columns.str.contains("A"))]]
but it says a boolean list is not a valid key
filter.df.filter(regex='Run|Date|A\.')?