我有以下数据框:
Sentence
0 Cat is a big lion
1 Dogs are descendants of wolf
2 Elephants are pachyderm
3 Pachyderm animals include rhino, Elephants and hippopotamus
我需要创建一个 python 代码,它查看上面句子中的单词,并根据以下不同的数据框计算每个单词的总和。
Name Score
cat 1
dog 2
wolf 2
lion 3
elephants 5
rhino 4
hippopotamus 5
例如,对于第 0 行,分数将为 1(猫)+ 3(狮子)= 4
我希望创建一个如下所示的输出。
Sentence Value
0 Cat is a big lion 4
1 Dogs are descendants of wolf 4
2 Elephants are pachyderm 5
3 Pachyderm animals include rhino, Elephants and hippopotamus 14
小怪兽爱吃肉
相关分类