Скажем, у вас есть такой фрейм данных:
df = pd.DataFrame({'sentiment': ['positive', 'positive', 'negative', 'positive'], 'sentence': ['This is cool!', 'this is ok', 'not very cool', '!!!']})
sentiment sentence
0 positive This is cool!
1 positive this is ok
2 negative not very cool
3 positive !!!
Вы хотите нарезать позитивы и затем считать вхождения !
(как я понял):
df[df['sentiment'] == 'positive'].sentence.str.count('!').sum()
Результат:
4