0

I have a questions about Pandas.

I wrote a following code :

df_all.loc[df_all['_merge'] == 'right_only', ['count', 'Discount', 'RefPrice']] = df_all.loc[df_all['_merge'] == 'right_only', ['old_count', 'old_Discount', 'old_RefPrice']].values

However, Python returns a warning:

Warning (from warnings module):
    File "C:\python-3.6.6.amd64\lib\site-packages\pandas\core\indexing.py", line 1472
        return self._getitem_tuple(key)
FutureWarning: 
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.
    
See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike

What can I do to avoid this warning?

Thank you very much.

Tim Stack
  • 3,170
  • 3
  • 16
  • 35
Chan
  • 2,855
  • 6
  • 27
  • 50

0 Answers0