dataframe_image
dataframe_image copied to clipboard
Dataframe as PNG object
Can we get the ability to return the styled Dataframe as a PNG object, without needing to save the image?
Even though dfi.export() is currently broken with respect to several situations (including on Google Colab), once I have the image object, I can use other means to save it.
This would address several issues, including #6 #7 #9 #13 #15
Seconded, exporting the image into buffer / loading it into an array would be great, because that would allow us to show that image with plotting libraries like matplotlib.
Is there any workaround for this issue?
The only "workaround" is to save the image to disk temporarily.
You can feed it to a BytesIO
object and show it in jupyter with Image
from Ipython.display
@LiZhongyangLi I'm confused how that helps with downloading the styled object as a PNG file if all we're doing is displaying it
Any update on this? Would be handy to have the image as an object
It is easy and not related to this package. Just use io.BytesIO
instead of filename.
import pandas as pd
import numpy as np
from io import BytesIO
import dataframe_image
bio = BytesIO()
df = pd.DataFrame(np.random.randint(0, 100, size=(30, 20)))
df.dfi.export(bio)
image_data = bio.read()
# do whatever you want