1
votes

When I try to take one series from dataframe I get this issue

anaconda3/lib/python3.6/site-packages/numpy/core/fromnumeric.py:52: FutureWarning: reshape is deprecated and will raise in a subsequent release. Please use .values.reshape(...) instead return getattr(obj, method)(*args, **kwds)

This is the code snippet

for idx, categories in enumerate(categorical_columns):
    ax = plt.subplot(3,3,idx+1)
    ax.set_xlabel(categories[0])
    box = [df[df[categories[0]] == atype].price for atype in categories[1]] 
    ax.boxplot(box)
1
How working box = [df.loc[df[categories[0]] == atype, 'price' ] for atype in categories[1]] ?jezrael
Or is necessary upgrade pandas/numpy/matplotlib.jezrael
still, the issue is there @jezrael3zcs
Do you try upgrade?jezrael
@jezrael It worked fine after I upgraded it, take this upvote.3zcs

1 Answers

1
votes

For avoid chained indexing use DataFrame.loc:

box = [df.loc[df[categories[0]] == atype, 'price'] for atype in categories[1]]

And for remove FutureWarning is necessary upgrade pandas with matplotlib.