Sentiment Analysis in Python
Violeta Misheva
Data Scientist
Sentiment analysis is the process of understanding the opinion of an author about a subject.
First element: Opinion/emotion
Second element: subject
_The camera on this phone is great but its battery life is rather disappointing. _
Third element: opinion holder
data.head()
data.label.value_counts()
0 3782
1 3719
Name: label, dtype: int64
data.label.value_counts() / len(data)
0 0.504199
1 0.495801
Name: label, dtype: float64
length_reviews = data.review.str.len()
type(length_reviews)
pandas.core.series.Series
# Finding the review with max length
max(length_reviews)
0 667
1 2982
2 669
3 1087
....
length_reviews = data.review.str.len()
# Finding the review with min length
min(length_reviews)
0 667
1 2982
2 669
3 1087
4 724
....
Sentiment Analysis in Python