Python Forum
Setting with copy warning
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting with copy warning
#1
Why am I getting the "setting with copy" warning with the code below? Am I not doing what they suggested? And the result is wrong so I guess there is some problem with this.
import pandas as pd
'''
...
'''
#dfout is a pd.DataFrame instance
dfout.columns=[0,1,2]
dfout.loc[:,3]=dfout.loc[:,0]
dfout.loc[:,4]=dfout.loc[:,1]
dfout.loc[:,5]=dfout.loc[:,2]
dfout.loc[:,6]=np.sqrt(dfout.loc[:,4]**2+dfout.loc[:,5]**2)
dfout.loc[:,7]=np.arctan(dfout.loc[:,5]/dfout.loc[:,4])/np.pi*360
Thanks
Reply


Messages In This Thread
Setting with copy warning - by catlessness - Feb-13-2023, 02:07 PM
RE: Setting with copy warning - by catlessness - Feb-13-2023, 02:09 PM
RE: Setting with copy warning - by Vadanane - Feb-13-2023, 10:26 PM
RE: Setting with copy warning - by Vadanane - Feb-14-2023, 09:59 AM
RE: Setting with copy warning - by catlessness - Feb-14-2023, 10:59 AM
RE: Setting with copy warning - by deanhystad - Feb-21-2023, 12:58 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020