You can save the Pandas DataFrame as an image with the given code.
Step 1: Install the library
pip install dataframe_image
Step 2: Import libraries and follow the code
import pandas as pd
import numpy as np
import dataframe_image as dfi
# Initialize a dictionary
dict = {'Students':['Harry', 'John', 'Hussain', 'Satish'],
'Scores':[77, 59, 88, 93]}
# Create a DataFrame
df = pd.DataFrame(dict)
# Add a gradient based on values
df_img = df.style.background_gradient()
# Save DataFrame as Image
dfi.export(df_img,"Data.png")Output:



