3

I am trying to export the data frame to an image. I used the dataframe_image lib to do this activity.

import pandas as pd
import dataframe_image as dfi

data = [
    {
        "name": "John",
        "gender": "Male"
    },
    {
        "name": "Martin",
        "gender": "Female"
    }
]

df = pd.json_normalize(data)
dfi.export(df, 'table.png')

The exported image looks like the below:

enter image description here

I want to remove the index column from this. How can I do that ?

1 Answer 1

2

You can set the style to hide the index:

dfi.export(df.style.hide(axis='index'), 'table.png')

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.