make_selector#
- skrub.selectors.make_selector(obj)[source]#
Normalize a selector, column name, or list of names into a
Selectorobject.This function converts user input into a consistent selector object:
Selectors are returned as-is
Strings are converted to
cols(name)Lists of strings are converted to
cols(*names)
- Parameters:
- Returns:
- Selector
A
Selectorobject (or subclass).
See also
colsSelect specific columns by name
Examples
This function is used to normalize user input so that the result is a selector compatible with the rest of the API.
>>> from skrub import selectors as s
Normalize a column name or list of column names:
>>> s.make_selector('ID') cols('ID') >>> s.make_selector(['ID', 'kind']) cols('ID', 'kind')
A selector is returned unchanged:
>>> s.make_selector(s.cols('ID', 'kind')) cols('ID', 'kind')