我对这个警告感到绝望。我正在做以下事情:groups = df.groupby('year')2018_group = groups.get_group('2018')if not 2018_group['Descripcion'].empty: desc = 2018_group.loc[2018_group['Descripcion'].notnull(), 'Desc'].copy() 2018_group.loc[:, 'Descripcion'] = desc.unique()[0] print 2018_group获取已知错误:SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrameSee the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy 2018_group.loc['Desc'] = desc.unique()[0]我想要做的是用该列中的非空值填充列“Desc”
2 回答

泛舟湖上清波郎朗
TA贡献1818条经验 获得超3个赞
您已设置使用相同语言的查询和数据库。然而,虽然 DB 使用的代码页有 850 个可能的字符,但您的会话有 1252 个可能的字符。当两者尝试通信时,查询和数据库之间存在无法匹配的符号。
cmd.exe /c chcp 1252 -> 将查询语言设置为 1252 个可能的字符 == db(1252 个可能的字符),从而解决了该问题。
添加回答
举报
0/150
提交
取消