始める無料で始める

Plotting sentiment scores

Lastly, let's plot the sentiment of each hashtag over time. This is largely similar to plotting the prevalence of tweets.

この演習はコースの一部です

Analyzing Social Media Data in Python

コースを見る

演習の手順

  • Plot a line for #python usage with sentiment_py. Use sentiment_py.index.day as the x-axis.
  • Do the same with sentiment_r.

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

# Import matplotlib
import matplotlib.pyplot as plt

# Plot average #python sentiment per day
plt.plot(____, ____, color = 'green')

# Plot average #rstats sentiment per day
plt.plot(____, ____, color = 'blue')

plt.xlabel('Day')
plt.ylabel('Sentiment')
plt.title('Sentiment of data science languages')
plt.legend(('#python', '#rstats'))
plt.show()
コードを編集して実行