Я пытаюсь создать простой график, но после применения это не имеет для меня никакого смысла groupBy()
df_cumulate = df.groupby(['date','sentiment'], as_index=False).sum()
def plot_df(df, x, y, title="", xlabel='Date', ylabel='Sentiment', dpi=100):
plt.figure(figsize=(16,5), dpi=dpi)
plt.plot(x, y, color='tab:red')
plt.gca().set(title=title, xlabel=xlabel, ylabel=ylabel)
plt.savefig('sentiment_over_time.png')
plt.show()
plot_df(df_cumulate, x=df_cumulate.index, y=df_cumulate.sentiment, title='Sentiment Over Time')
If I changed into x=df_cumulate.date
, will get this. The Sentiment
sum()
logically must more than 1 or below than -1.
dataset: https://gist.github.com/datomnurdin/33961755b306bc67e4121052ae87cfbc