-
-
Notifications
You must be signed in to change notification settings - Fork 45
Description
The case that I will explain below only happens when generating the image, when I open the html generated by pandas, the space appears correctly, that's why I decided to ask here.
All the ways I've tried to prevent the text set in set_caption from touching the top of the image, including margin-top and the like, have not worked and the text continues to touch the top of the image as if I hadn't even added anything to prevent it.
Is there any way around this?
My base code is this:
df = df[['country','competition','match','market','option','matched weight','above expectations','odds','result','back','cum_sum']]
styles = {}
for key in df.columns:
styles[key] = [{"selector": "th",
"props": [("text-align", "center"),
("background-color", "#40466e"),
("color", "white")]}]
df = df.style.set_properties(subset=df.columns, **{'text-align': 'center'}).hide(axis='index')
df = df.set_table_styles(styles)
df = df.applymap(map_colors, subset=["result"])
df = df.set_caption(f"<h2 style='font-size: 16px'>Filial Weight of Flow - {ytd_telegram}</h2>")
dfi.export(df, "weight_of_flow.png", table_conversion="selenium", max_rows=-1)
It generates this image:
But even adding margin-top to set_caption the result is still exactly the same with the text touching the top of the image.
I didn't even want to increase the size of the image, but since by default it is touching the top, I tried to put margin-top but it still didn't work, I just wanted the text to be centered in that white space.
You who have full knowledge regarding dataframe_image, could you help me solve this case, please?
