0
索引我有一個熊貓數據幀,看起來像添加列由另一列
some_data another_id
id
312871 ... abc
312977 ... def
...
和字典letters = {"abc": "x", "def": "y"}
大熊貓數據幀。我想將letters
作爲列添加到我的數據框中,但它的道德索引爲another_id
,因此我不能只設置df["letters"] = letters
。
我相信有一個美麗的,優雅的方式來做到這一點。它是什麼?
woop woop,那也工作,謝謝。 – katrielalex