Home > front end >  I have a Dataframe with a lot of text content and I wish to save it as a table (in .PNG) with some f
I have a Dataframe with a lot of text content and I wish to save it as a table (in .PNG) with some f

Time:09-22

I have a Dataframe with a long text content and I wish to save it as a table (in .PNG) with some formatting. Can you please suggest the packages and technique? I'm a newbie to python

CodePudding user response:

try dataframe_image https://pypi.org/project/dataframe-image/

pip install dataframe_image

Import the packages

import pandas as pd
import numpy as np
import dataframe_image as dfi
df = pd.DataFrame(np.random.randn(6, 6), columns=list('UVWXYZ'))

Add some gradient

df_styled = df.style.background_gradient()
dfi.export(df_styled,"dataframe.png")
  • Related