【发布时间】:2022-07-07 19:53:59
【问题描述】:
我有数据框:
data = {'text': ['They say that all cats land on their feet, but this does not apply to my cat. He not only often falls, but also jumps badly. We have visited the veterinarian more than once with dislocated paws and damaged internal organs.',
'Mom called dad, and when he came home, he took moms car and drove to the store'],
'begin_end':[[128, 139],[20,31]]}
df = pd.DataFrame(data)
我想使用begin_end 列中的一个数组将text 列中的单词提取到一个新列中,例如text[128:139+1]。所以它会是:
begin_end new_col
0 [128, 139] have visited
1 [20, 31] when he came
【问题讨论】: