'How to center Headers and Common Text of a Dataframe that will create an Image with these values?

If I want to center the headers to print, we can do:

pd.set_option('colheader_justify', 'center')

But when I try to center all the text in creating an image with the values, they keep positioned not centered:

DATA,HORA,CAMPEONATO,JOGO,CANAIS
20/02/2022,08:30,Campeonato Italiano,Fiorentina x Atalanta,"ESPN 2, STAR+"
20/02/2022,09:00,Campeonato Escocês,Dundee Utd x Rangers,STAR+
20/02/2022,09:00,Campeonato Piauiense,Flamengo PI x Fluminense PI,ELEVENSPORTS.COM

import pandas as pd
import dataframe_image as dfi

df = pd.read_csv("tabela_para_imagem.csv")
pd.set_option('colheader_justify', 'center')
df_styled = df.style.set_properties(**{'text-align': 'center'})
dfi.export(df_styled,"mytable.png")

enter image description here

My expected result is:

enter image description here

How should I proceed to be able to centralize all the values?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source