pysentimentanalyzer.get_aggregated_sentiment_score

Module Contents

Functions

aggregate_sentiment_score(df, col)

Returns an aggregated compound score representing sentiment:

pysentimentanalyzer.get_aggregated_sentiment_score.aggregate_sentiment_score(df, col)[source]

Returns an aggregated compound score representing sentiment: -1 (most extreme negative) and +1 (most extreme positive). The compound score is a normalized score calculated by summing the valence scores of each word in the lexicon.

Parameters:

dfPandas DataFrame

DataFrame containing the reviews

colstr

Column name in the dataframe that contains the reviews

Returns:

aggregated sentiment score of the text rounded to 3 decimal points: (float)

Examples

>>> agg_score = aggregate_sentiment(df, "reviews")
>>> agg_score
0.81