Reputation: 3
I am trying to extract rows from dataframe using .loc[]
but getting this error:
KeyError: 'Passing list-likes to .loc or [] with any missing labels is no
longer supported, see https://pandas.pydata.org/pandas-
docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike'
my code is:
new_data = pd.get_dummies(data,drop_first=True)
features = list(set(data.columns)-set(['Price']))
x = new_data.loc[:,features].astype(float)
please give me a simple answer or in a way I can understand since I am new to this.
Upvotes: 0
Views: 123
Reputation: 1624
How about this:
features = set(data.columns.drop('Price'))
x = new_data.loc[:,features].astype(float)
Upvotes: 1