【发布时间】:2021-10-16 13:15:04
【问题描述】:
我有一个数据框:
Text
Background
Clinical
Method
Direct
Background
Direct
现在我想根据它们的第一个单词将它们分组到新列中,例如 Background 属于第 1 组 Clinical 属于第 2 组,就像这样。
预期输出:
一个数据框:
Text Group
Background 1
Clinical 2
Method 3
Direct 4
Background 1
Direct 4
【问题讨论】:
标签: python python-3.x pandas dataframe numpy