Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Categorical binning in sentiment analysis

$
0
0

@siddharth238 wrote:

Hi everyone,
I want to make bins where values less than zero are negative, more than zero are positive and zero itself is neutral but if I divide them in bins then I can only use two labels. Can anyone tell me how to showcase zero as neutral instead of negative?

bins = [-1, 0, 1]
labels = [“Negative”, “Positive”]
FinalResults[‘Sentiment’] = pd.cut(FinalResults[‘Polarity’], bins=bins, labels=labels)

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles