dexplo / dataframe_image

A python package for embedding pandas DataFrames as images into pdf and markdown documents
https://dexplo.org/dataframe_image
MIT License
282 stars 41 forks source link

Round to two decimal places #44

Closed antonkurtis closed 2 years ago

antonkurtis commented 2 years ago

How can I round to two decimal places all numbers in DF? Now use this: df_styled = df.style.background_gradient() dfi.export(df_styled, "adv.png") Return 6 decimal places

Thank you!

tdpetrou commented 2 years ago

I believe you'll need to use the styler format method. See here for more details. https://pandas.pydata.org/docs/reference/api/pandas.io.formats.style.Styler.format.html