0
索引我有一个熊猫数据帧,看起来像添加列由另一列
some_data another_id
id
312871 ... abc
312977 ... def
...
和字典letters = {"abc": "x", "def": "y"}
大熊猫数据帧。我想将letters
作为列添加到我的数据框中,但它的道德索引为another_id
,因此我不能只设置df["letters"] = letters
。
我相信有一个美丽的,优雅的方式来做到这一点。它是什么?
woop woop,那也工作,谢谢。 – katrielalex