मैं मामलों में SettingWithCopyWarning
त्रुटियों जहां मैं उन्हें अपेक्षा नहीं मिल (?):SettingWithCopyWarning, तब भी जब loc का उपयोग कर
N.In <38>: # Column B does not exist yet
N.In <39>: df['B'] = df['A']/25
N.In <40>: df['B'] = df['A']/50
/Users/josh/anaconda/envs/py27/lib/python2.7/site-packages/pandas/core/indexing.py:389: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_index,col_indexer] = value instead
self.obj[item] = s
और
N.In <41>: df.loc[:,'B'] = df['A']/50
/Users/josh/anaconda/envs/py27/lib/python2.7/site-packages/pandas/core/indexing.py:389: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_index,col_indexer] = value instead
self.obj[item] = s
यह मामला 1 और 2 में क्यों होता है?
आपको कोड दिखाने की ज़रूरत है इससे पहले (जितना आप कर सकते हैं) – Jeff
धन्यवाद @ जेफ मैंने ओपी को कुछ पिछली लाइनों के साथ अपडेट किया –
इससे पहले जोड़ें; आप पहले – Jeff