【发布时间】:2017-07-19 17:44:00
【问题描述】:
我有以下数据框df:
Customer_ID | 2015 | 2016 |2017 | Year_joined_mailing
ABC 5 6 10 2015
BCD 6 7 3 2016
DEF 10 4 5 2017
GHI 8 7 10 2016
我想查找客户在加入邮件列表的那一年的价值并将其保存在新列中。
输出将是:
Customer_ID | 2015 | 2016 |2017 | Year_joined_mailing | Purchases_1st_year
ABC 5 6 10 2015 5
BCD 6 7 3 2016 7
DEF 10 4 5 2017 5
GHI 8 9 10 2016 9
我在 python 中找到了一些匹配 vlookup 的解决方案,但没有一个会使用其他列的标题。
【问题讨论】:
-
查找是 2015、2016 和 2017 列
标签: python pandas match lookup