0

对于我的代码,请参见下文:

#tfids words word cloud
import matplotlib.pyplot as plt
from wordcloud import WordCloud
import pandas as pd

tf = pd.DataFrame(columns=['word'])

tf['word'] = ['federalist', 'wrexham', 'remy', 'islamic', 'hegseth', 'hereford', 'gbt', 'sharenet', 'cpr', 'vegas', 'krvn', 'bandidos', 'nginx', 'manafort' , 'roth', 'kennedy' ,'pence', 'quantum']

wordcloud10 = WordCloud().generate(' '.join(tf['word']))
plt.imshow(wordcloud10)
plt.axis("off")
plt.title("")
plt.show()
display()

在数据块中,必须使用 display 才能看到图表。尽管有上述代码,但我没有看到 wordcloud。O/pi 如下图:

Out[1106]: <matplotlib.image.AxesImage at 0x7fae917806d0>
Out[1106]: (-0.5, 399.5, 199.5, -0.5)
Out[1106]: <matplotlib.text.Text at 0x7faeb31a6110>

谢谢你的帮助。 Databricks 的屏幕截图 - 无图表

4

0 回答 0