【发布时间】:2017-08-11 23:33:22
【问题描述】:
在 Python Pandas 中,我有一个包含以下格式的列和记录的数据框:
text source senti
-------------------------------
great food site1 0.6
awful staff site4 -0.4
good chef site8 0.4
average food site6 0.05
bad food site2 -0.8
文本列本质上是对某事的描述或意见。我想对数据集的平均情绪得出一些结论,输出如下。
sentiment count
----------------
positive 2
neutral 1
negative 2
我们将 'senti' 的计数分为正面、负面或中性。
满足以下条件的情绪计入每组:
- 积极记录的情绪 >0.1
- 中性记录的得分 >-0.1 AND
- 负面记录得分
提前致谢
【问题讨论】:
-
将
pandas.qcut与自定义垃圾箱一起使用
标签: python pandas group-by aggregate pandas-groupby