check_all_variables#

feature_engine.variable_handling.check_all_variables(X, variables)[source]#

Checks that the variables in the list are in the dataframe.

More details in the User Guide.

Parameters
Xpandas dataframe of shape = [n_samples, n_features]

The dataset

variableslist

The list with the names of the variables to check.

Returns
variables: List

The names of the variables.

Examples

>>> import pandas as pd
>>> from feature_engine.variable_handling import check_all_variables
>>> X = pd.DataFrame({
>>>     "var_num": [1, 2, 3],
>>>     "var_cat": ["A", "B", "C"],
>>>     "var_date": pd.date_range("2020-02-24", periods=3, freq="T")
>>> })
>>> vars_all = check_all_variables(X, ['var_num', 'var_cat', 'var_date'])
>>> vars_all
['var_num', 'var_cat', 'var_date']
Return type

List[Union[str, int]]