Movie review
Importpandasaspd
FromtextblobimportTextBlob
FromwordcloudimportWordCloud,STOPWORDS
Importmatplotlib.pyplotaspl
#Loadthedataset
Df=pd.read_csv(‘movie_review.csv’)
#AddacolumnforsentimentanalysisusingTextBlob
Df[‘Sentiment’]=df[‘Review’].apply(lambdax:TextBlob(x).sentiment.polarity)
#Createanewdataframeforpositivereviewsonly
Pos_df=df[df[‘Sentiment’]>0.2]
#Createawordcloudforpositivereviews
Wordcloud=WordCloud(width=800,height=800,
Background_color=’white’,
Stopwords=STOPWORDS,
Min_font_size=10).generate(‘‘.join(pos_df[‘Review’]))
#Plotthewordcloud
Plt.figure(figsize=(8,8),facecolor=None)
Plt.imshow(wordcloud)
Plt.axis(“off”)
Plt.tight_layout(pad=0)
Plt.show()