amueller / word_cloud

A little word cloud generator in Python
https://amueller.github.io/word_cloud
MIT License
10.02k stars 2.31k forks source link

generate_from_frequencies no longer working #766

Open Dmonzer opened 1 month ago

Dmonzer commented 1 month ago

Description

worldcloud.generate_from_frequencies is creating this error: OSError: cannot open resource

I ran the exact same code below 1 month ago and it worked fine. For some reason, it is not working anymore. Code: ''' from wordcloud import WordCloud import matplotlib.pyplot as plt import pandas as pd

word_counts = df_weather['WEATHERNAME'].value_counts().to_dict() wordcloud = WordCloud(width=800, height=400, background_color='white') wordcloud.generate_from_frequencies(word_counts) plt.figure(figsize=(10, 5)) plt.imshow(wordcloud, interpolation='bilinear') plt.axis('off') # Hide axes plt.title('Weather Condition Occurrences') plt.show()



#### Versions
<!--
Please run the following snippet and paste the output below.
import platform; print(platform.platform())
import sys; print("Python", sys.version)
import numpy; print("NumPy", numpy.__version__)
import matplotlib; print("matplotlib", matplotlib.__version__)
import wordcloud; print("wordcoud", wordcloud.__version__)
-->
Windows-10-10.0
Python 3.7.8 | packaged by conda-forge |
NumPy 1.21.6
matplotlib 3.5.3
wordcoud 1.9.3

<!-- Thanks for contributing! -->
welpo commented 2 weeks ago

Did you figure this out?

generate_from_frequencies works without issues for me. I'm using a Counter from collections.

Might be related to the specific versions I'm using. If it helps:

Python 3.12.3
NumPy 1.26.4
matplotlib 3.8.4
wordcoud 1.9.3