Aeon-Avinash commited on
Commit
6808fb2
·
verified ·
1 Parent(s): ee8552d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -38,7 +38,7 @@ def create_charts(df):
38
  # Create Pie Chart for Sentiment Distribution
39
  sentiment_counts = df['Sentiment'].value_counts()
40
  fig1, ax1 = plt.subplots(figsize=(8, 6))
41
- ax1.pie(sentiment_counts, labels=sentiment_counts.index, autopct='%1.1f%%', colors=['skyblue', 'lightcoral'])
42
  ax1.set_title('Distribution of Positive and Negative Reviews')
43
 
44
  # Create Scatter Plot for Sentiment Scores
@@ -83,7 +83,7 @@ def analyze_reviews(file_path):
83
  [df['Sentiment'], df['Sentiment Score']] = zip(*results)
84
 
85
  # Adjust the sentiment score to be negative if the sentiment is negative
86
- df.loc[df['Sentiment'].lower() == 'negative' , 'Sentiment Score'] *= -1
87
 
88
  pie_chart, scatter_plot = create_charts(df)
89
 
 
38
  # Create Pie Chart for Sentiment Distribution
39
  sentiment_counts = df['Sentiment'].value_counts()
40
  fig1, ax1 = plt.subplots(figsize=(8, 6))
41
+ ax1.pie(sentiment_counts, labels=sentiment_counts.index, autopct='%1.1f%%', colors=['skyblue', 'lightcoral', 'lightgreen'])
42
  ax1.set_title('Distribution of Positive and Negative Reviews')
43
 
44
  # Create Scatter Plot for Sentiment Scores
 
83
  [df['Sentiment'], df['Sentiment Score']] = zip(*results)
84
 
85
  # Adjust the sentiment score to be negative if the sentiment is negative
86
+ df.loc[df['Sentiment'].str.lower() == 'negative' , 'Sentiment Score'] *= -1
87
 
88
  pie_chart, scatter_plot = create_charts(df)
89