0

I am finding the max of df2 by row, and setting the max value to new col on df1.

df1['max'] = df2[df2.keys().tolist()].max(axis=1)

This line is throwing a SettingWithCopyWarning. Not sure how to re-write it to make the warning go away. How to re-write it?

Yash
  • 1
  • 2
  • It looks good to me, you need provide more info. – Ynjxsjmh May 06 '22 at 16:53
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 11 '22 at 02:19

1 Answers1

0

The warning typically is a result of chained assignments and you can read more about it in this answer and this blog post also goes into great detail.

If you wish to turn it off, you can use:

pd.options.mode.chained_assignment = None
greco
  • 304
  • 4
  • 11