我有一个包含大量文本内容的 Dataframe,我希望将其保存为具有某种格式的 table(.PNG 格式)

I have a Dataframe with a lot of text content and I wish to save it as a table (in .PNG) with some formatting

我有一个包含长文本内容的 Dataframe,我希望将其保存为具有某种格式的 table(.PNG 格式)。你能推荐一下包装和技术吗?我是 python

的新手

尝试dataframe_image https://pypi.org/project/dataframe-image/

pip install dataframe_image

导入包

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

添加一些渐变

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