1
у меня есть dataframe как нижеWordcloud из кадра данных с частотой питона
Int64Index: 14830 entries, 25791 to 10668
Data columns (total 2 columns):
word 14830 non-null object
coef 14830 non-null float64
dtypes: float64(1), object(1)
я пытаюсь сделать облако слов с коэф как частоты вместо рассчитывать для обильного
text = df['word']
WordCloud.generate_from_text(text)
TypeError: generate_from_text() missing 1 required positional argument: 'text'
или
text = np.array(df['word'])
WordCloud.generate_from_text(text)
TypeError: generate_from_text() missing 1 required positional argument: 'text'
Как я могу улучшить этот код & made word cloud как это
from wordcloud import WordCloud
wordcloud = WordCloud(ranks_only= frequency).generate(text)
plt.imshow(wordcloud)
plt.axis('off')
plt.show()
благодаря
МОЙ ОТВЕТ
первым мы получаем список кортежей
tuples = [tuple(x) for x in df.values]
затем
wordcloud = WordCloud().generate_from_frequencies(tuples)
это все