Error while converting daraframe_to_arrays

inputs_array, targets_array = dataframe_to_arrays(dataframe)
inputs_array, targets_array


KeyError Traceback (most recent call last)
in ()
----> 1 inputs_array, targets_array = dataframe_to_arrays(dataframe)
2 inputs_array, targets_array

3 frames
/usr/local/lib/python3.6/dist-packages/pandas/core/indexing.py in _validate_read_indexer(self, key, indexer, axis, raise_missing)
1296 if missing == len(indexer):
1297 axis_name = self.obj._get_axis_name(axis)
-> 1298 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
1299
1300 # We (temporarily) allow for some missing keys with .loc, except in

KeyError: “None of [Index([(‘age’, ‘sex’, ‘bmi’, ‘children’, ‘smoker’, ‘region’, ‘charges’)], dtype=‘object’)] are in the [columns]”

As i understand you refer to this function

Notice you have categorical_cols, input_cols and output_cols lists which are out of the scope of the function. Make sure your columns are consistent with the lists defined before.

dataframe_to_arrays() function requires lists not index type objects.

I answered the same question here.

It is an iterating and filtering issue.