为什么每列都不会附加到系列中?id_names = pd.Series()for column in n_df: id_names.append(n_df[column].drop_duplicates(), ignore_index = True)id_names
1 回答
大话西游666
TA贡献1817条经验 获得超14个赞
您未能将附加结果重新分配回系列。 pd.Series.append不是就地方法。你需要重新分配。
id_names = pd.Series()
for column in n_df:
id_names = id_names.append(n_df[column].drop_duplicates(), ignore_index = True)
id_names
但是,有一种更简单的方法可以完成此任务。
尝试:
n_df.melt()
添加回答
举报
0/150
提交
取消
