pandas 0.9.1 documentation

pandas.DataFrame.filter

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

Restrict frame’s columns to set of items or wildcard

Parameters :

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

Returns :

DataFrame with filtered columns :

Notes

Arguments are mutually exclusive, but this is not checked for