Spaces:
Runtime error
Runtime error
Update eda.py
Browse files
eda.py
CHANGED
@@ -4,11 +4,21 @@ import matplotlib.pyplot as plt
|
|
4 |
from wordcloud import WordCloud
|
5 |
|
6 |
def display_eda(data):
|
|
|
|
|
|
|
|
|
|
|
7 |
# Distribution of sentiments
|
8 |
st.subheader("Distribution of Sentiments")
|
9 |
sentiment_counts = data['sentiment'].value_counts()
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
12 |
# Word cloud for each sentiment
|
13 |
st.subheader("Word Clouds for Sentiments")
|
14 |
sentiments = data['sentiment'].unique()
|
|
|
4 |
from wordcloud import WordCloud
|
5 |
|
6 |
def display_eda(data):
|
7 |
+
# Check if 'sentiment' column exists in the dataset
|
8 |
+
if 'sentiment' not in data.columns:
|
9 |
+
st.error("The dataset does not contain a 'sentiment' column. Please check the data source.")
|
10 |
+
return
|
11 |
+
|
12 |
# Distribution of sentiments
|
13 |
st.subheader("Distribution of Sentiments")
|
14 |
sentiment_counts = data['sentiment'].value_counts()
|
15 |
+
fig, ax = plt.subplots()
|
16 |
+
sentiment_counts.plot(kind='bar', ax=ax)
|
17 |
+
ax.set_title('Distribution of Sentiments')
|
18 |
+
ax.set_xlabel('Sentiment')
|
19 |
+
ax.set_ylabel('Count')
|
20 |
+
st.pyplot(fig)
|
21 |
+
|
22 |
# Word cloud for each sentiment
|
23 |
st.subheader("Word Clouds for Sentiments")
|
24 |
sentiments = data['sentiment'].unique()
|