For the longest time, I've been using
dfi.export(df1, "test.png")
to export a dataframe styler (df1) with type pandas.io.formats.style.Styler into a .png.
Today I get the following error:
Traceback (most recent call last):
File ~\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py:3369 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Input In [48] in <cell line: 1>
dfi.export(df1, "ice_cotton_" + str(dashboard_date).split(" ")[0])
File ~\Anaconda3\lib\site-packages\dataframe_image\_pandas_accessor.py:48 in export
return _export(
File ~\Anaconda3\lib\site-packages\dataframe_image\_pandas_accessor.py:117 in _export
img_str = converter(html)
File ~\Anaconda3\lib\site-packages\dataframe_image\_screenshot.py:188 in run
img = self.take_screenshot()
File ~\Anaconda3\lib\site-packages\dataframe_image\_screenshot.py:140 in take_screenshot
img = mimage.imread(buffer)
File ~\Anaconda3\lib\site-packages\matplotlib\image.py:1560 in imread
with img_open(fname) as image:
File ~\Anaconda3\lib\site-packages\PIL\ImageFile.py:112 in __init__
self._open()
File ~\Anaconda3\lib\site-packages\PIL\PngImagePlugin.py:676 in _open
raise SyntaxError("not a PNG file")
File <string>
SyntaxError: not a PNG file
How do I fix this?
This is a set of possible solutions and only the last one worked for me: