【发布时间】:2020-06-22 04:02:37
【问题描述】:
我有两个数据框。 df1 是主要的 df,df2 是参考数据帧。 df1 看起来像这样:
u1d Status: Partisipant status Country:Country from URL
122 2 4
123 4 11
124 1 14
和 df2 看起来像这样,这是一个参考。
我希望在 df1 中我的所有值都映射到代码,例如 Status: Participant status 2 is Terminated 所以它应该代替 2 映射为 Terminated 和所有其他列。我有大约 2000 列,所以我也需要有效的方法。
【问题讨论】:
-
@jezrael 你能帮忙吗?
-
是的,我创建了答案。
标签: python pandas dictionary mapping