def word_count_by_label(articles: pd.DataFrame):
"""Show graph of word counts by article label."""
palette = sns.color_palette(palette='hls', n_colors=2)
true_news_wc = articles[articles['labels'] == 0]['word_count']
fake_news_wc = articles[articles['labels'] == 1]['word_count']
sns.kdeplot(true_news_wc, bw=3, color=palette[0], label='True News')
sns.kdeplot(fake_news_wc, bw=3, color=palette[1], label='Fake News')
sns.plt.legend()
sns.plt.show()
评论列表
文章目录