【发布时间】:2020-12-17 17:13:32
【问题描述】:
我有下一个df:
Match Count
Asren_Blue_Coached 879
Asren_Blue_NotCoached 721
Asren_RED_Coached 6567
Asren_RED_NotCoached 764
Asren_White_Coached 762
Asren_White_NotCoached 431
Asren_Yellow_Coached 375
Asren_Yellow_NotCoached 412
Hrew_Blue_Coached 689
Hrew_Blue_NotCoached 634
...
我想添加三个新列,
“匹配”列中下划线前的每个单词一列
因此,预期的输出如下所示:
Match NewCol1 NewCol2 NewCol3 Count
Asren_Blue_Coached Asren Blue Coached 879
Asren_Blue_NotCoached Asren Blue NotCoached 721
Asren_RED_Coached Asren RED Coached 6567
Asren_RED_NotCoached Asren RED NotCoached 764
Asren_White_Coached Asren White Coached 762
Asren_White_NotCoached Asren White NotCoached 431
Asren_Yellow_Coached Asren Yellow Coached 375
Asren_Yellow_NotCoached Asren Yellow NotCoached 412
Hrew_Blue_Coached Hrew Blue Coached 689
Hrew_Blue_NotCoached Hrew Blue NotCoached 634
...
你知道我该怎么做吗?
我正在 Jupyter 中使用 pandas
【问题讨论】: