Skip to content Skip to sidebar Skip to footer

Keyerror: "none Of [index([('a','b','c')] , Dtype='object')] Are In The [columns]

I defined my X and y as follows: X=df[text_columns + categorical_columns + textual_columns + numeric_columns] y=df[['Label']] where text_columns='Tweet' categorical_columns=['A',

Solution 1:

If numeric_columns (and any of the others) are tuples, then you do

X[numeric_columns]

instead of

X[[numeric_columns]]

to select that subset of columns from a pandas DataFrame

Post a Comment for "Keyerror: "none Of [index([('a','b','c')] , Dtype='object')] Are In The [columns]"