set_valid_and_invalid_variable_values#

Survey.set_valid_and_invalid_variable_values(column_selection: str | int | list | ndarray | Series | range | Callable[[SurveyVariable], bool] | None = None, valid_values: dict | None = None, invalid_values: dict | None = None, suppress_check_var_warning: bool = False)#

Set the dictionaries of valid and invalid values (and their labels) for selected variables. This does not change the data.

Parameters#

column_selectionstr, int, list, np.ndarray, pd.Series, range, QuestionSelector or None

If None, all columns are taken into account. Otherwise, a subset will be considered. The parameter is interpreted as described in Survey.interpret_column_selection().

valid_valuesdict, optional

A dictionary containing items (value, label) for the valid values of the selected variables.

invalid_valuesdict, optional

A dictionary containing items (value, label) for the invalid values of the selected variables.

suppress_check_var_warningbool

If True, don’t show a warning if there are ‘unusable’ variables after the change. A variable is unusable, if we can not automatically create features for the corresponding question.