1

I want to export a series of DFs as .png When I run the code i receive this error:

ValueError: Your Styled DataFrame has more than 100 rows and will produce a huge image file, possibly causing your computer to crash. Override this error by explicitly setting max_rows to -1 for all columns. Styled DataFrames are unable to select a subset of rows or columns and therefore do not work with the max_rows and max_cols parameters

How can I overcome this problem? I tried to insert "pd.set_option('display.max_rows', 500)", but it still doesn't work.

  • Hope this link will help you : https://stackoverflow.com/questions/35634238/how-to-save-a-pandas-dataframe-table-as-a-png – Mohamed Ibnyaiche Jan 20 '22 at 11:16
  • later versions of pandas have max_rows option for pandas Styler output, although i dont recognise this error and it might be related to an external image generating library – Attack68 Jan 20 '22 at 17:40

1 Answers1

4

I go the same error when trying to use

import dataframe_image as dfi
dfi.export(styler,filename+'.png')

and my error is solved by adding "max_rows=-1", namely

dfi.export(styler,filename+'.png',max_rows=-1)

hope this helps.

Yuan Ren
  • 285
  • 3
  • 8