A value is trying to be a set on a copy of a slice from a DataFrame.

投稿者: | 2021-12-28

スライスのコピー

参考HP:https://note.nkmk.me/python-pandas-setting-with-copy-warning/https://note.nkmk.me/python-pandas-setting-with-copy-warning/

エラー例:

different_cols = ['RELAFFIL', 'SATMTMID', 'CURROPER', 'INSTNM', 'STABBR']
col2 = college[different_cols] # ここでスライスのコピーとなっている
col2['RELAFFIL'] = col2['RELAFFIL'].astype('int8')