I want to select some columns by name, like
selection = df[['Name', 'Qualification']]
and some columns by a filter like
selection = df.filter(regex=("Level.*"))
How to combine those selections in one instruction?
>Solution :
If you can list all of the column names you want (as in, the number isn’t massive), you can do this:
selection = df.filter(regex=("Level.*|Name|Qualification"))
The | character in the regex means or, so that line will take any column that matches one of:
"Level.*""Name""Qualification"