pandas.DataFrame.filter

DataFrame.filter(items=None, like=None, regex=None)

Restrict frame’s columns to set of items or wildcard

items : list-like
List of columns to restrict to (must not all be present)
like : string
Keep columns where “arg in col == True”
regex : string (regular expression)
Keep columns with re.search(regex, col) == True

Arguments are mutually exclusive, but this is not checked for

DataFrame with filtered columns