我有一些密码:
df.groupby(['Image','Roi']).apply(lambda x: x.loc[~(x.duplicated(['Total']) & x.Total.isnull())])我希望将"Total“替换为包含空格的更长的熊猫列名,但这会引发语法错误:
df.groupby(['Image','Roi']).apply(lambda x: x.loc[~(x.duplicated(['Total size']) & x.['Total size'].isnull())])发布于 2016-07-06 17:33:23
访问数组元素时不要使用点:
x.['Total size'].isnull()
^相反,只需使用括号:
x['Total size'].isnull()https://stackoverflow.com/questions/38230117
复制相似问题