dataframe_image
dataframe_image copied to clipboard
Export styled dataframe to png not working with matplotlib
Hello,
I have run the following example code to export a dataframe to a png, using the "matplotlib" table converter.
import dataframe_image as dfi
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.rand(6, 4))
df_styled = df.style.background_gradient()
dfi.export(df_styled, 'df_styled.png', table_conversion='matplotlib')
The image is exported without errors (only a warning about the helvetica font not being found). However, when opening the image afterwards, the style of the dataframe has disappeared and a simple dataframe without colors is displayed. On the other hand, when using "chrome" as a table converter, the dataframe is correctly exported with its style. Sadly, in the environement in which I am working, chrome is not available and I can't install it there, so this is not an option.
Is this the "expected" behavior when using matplotlib, or should it work like with chrome, i.e. export dataframe colors too?
+1
Same behaviour here : I do apply a custom style to make some cells bold, but this does not render in the png
have same case here. have you got any solution to it?
@tdpetrou HI sorry to trouble you. Have you got the porblem same with us . Export styled dataframe to png not working with matplotlib
+1
+1
Same problem here. Using the library on Google Colab, with the Matplotlib convertre all formatting is lost.
Same
Same issue here as well. Working on a data notebook platform and only the un-styled matplotlib converter working.
+1
Im having the same problem as well
+1
I'll diagnose it later, but it seems a limitation of matplotlib
.
Hi guys, Any updates for the export styled data frame using matplotlib table conversion?
Hi @PaleNeutron - any update on that ?
Run into this problem as well
Deploying a styled dataframe object using chrome table converter does not work here; produces an image, but only a thin strip of what looks like the very top of the expected image. Deploying the matplotlib table converter does produce an image, but has similar issues to those described above; specifically colour stying disappears.
Supported now!
Nice! Thanks a lot. Is it released?
@paulhybryant Already released.
Thanks!