【发布时间】:2020-09-22 03:49:17
【问题描述】:
我在下面有一个 df_a,在下面的列中有文本值,
ID | Comment
2 @thomas what do you mean?
3 @Rob yes
4 @carol @3423 no way
45 @13121 @Mike yes sir
如何创建一个新列,其名称在评论列中的 @ 符号之后?如果该名称存在于我的另一个名为 df_b 的 df 中,我只想创建该列,其中 column_name 如下所示:
df_b:
column_name
Mike
Rob
thomas
carol
预期输出:
ID | Comment | name
2 @thomas what do you mean? thomas
3 @Rob yes Rob
4 @carol @3423 no way carol
45 @13121 @Mike yes sir mike
谢谢!
【问题讨论】:
标签: python python-3.x regex pandas