728x90 반응형 settingWithCopyWarning1 [Python] Pandas 'settingWithCopyWarning' 경고 메세지 없애기 증상 df2 = df[['A']] df2['A'] /= 2 df2 A 0 2.5 1 4.5 2 3.5 해결 방법 1. (recommended) Use loc to lice subsets df2 = df.loc[:, ['A']] df2['A'] /= 2 # Does not raise 2. pd.options.mode.chained_assignment 모드 변경 pd.options.mode.chained_assignment = None df2['A'] /= 2 3. Make a deepcopy df2 = df[['A']].copy(deep=True) df2['A'] /= 2 References stackoverflow.com/questions/20625582/how-to-deal-with-settingwit.. 2021. 5. 9. 이전 1 다음 728x90 반응형