Kurkur99 commited on
Commit
298c4f8
1 Parent(s): 0bd7d7b

Update eda.py

Browse files
Files changed (1) hide show
  1. eda.py +3 -3
eda.py CHANGED
@@ -18,7 +18,7 @@ def label_sentiment(rating):
18
  def process_review(review):
19
  """Simple processing for the review text."""
20
  review = review.lower()
21
- review = re.sub(r'[^a-z\s]', '', review) # Remove non-alphabetical characters
22
  return review
23
 
24
  def display_eda(data):
@@ -48,7 +48,7 @@ def display_eda(data):
48
  subset = data[data['sentiment'] == sentiment]
49
  text = " ".join(process_review(review) for review in subset['review_description'])
50
  wordcloud = WordCloud(max_words=100, background_color="white").generate(text)
51
- plt.figure()
52
  plt.imshow(wordcloud, interpolation="bilinear")
53
  plt.axis("off")
54
- st.pyplot()
 
18
  def process_review(review):
19
  """Simple processing for the review text."""
20
  review = review.lower()
21
+ review = re.sub(r'[^a-z\s]', '', review) # Remove non-alphabetical characters
22
  return review
23
 
24
  def display_eda(data):
 
48
  subset = data[data['sentiment'] == sentiment]
49
  text = " ".join(process_review(review) for review in subset['review_description'])
50
  wordcloud = WordCloud(max_words=100, background_color="white").generate(text)
51
+ fig = plt.figure()
52
  plt.imshow(wordcloud, interpolation="bilinear")
53
  plt.axis("off")
54
+ st.pyplot(fig)