Using numerical and categorical variables together
from sklearn.compose import make_column_selector as selector
numerical_columns_selector = selector(dtype_exclude=object)
categorical_columns_selector = selector(dtype_include=object)
numerical_columns = numerical_columns_selector(data)
categorical_columns = categorical_columns_selector(data)
What do you think of including a disclaimer here that users to check their data before assuming that “objects” are really “categorical”? In my experience working with data, when I load data from csv to pandas, numerical fields are typically read in as “objects” and I need to convert them.