1

I am using pandas to save a large amount of data as an excel file. This takes a few dozen seconds, and if the user clicks on the excel file before it is completed, excel will tell them the file is corrupted.

For a for loop / iterable, the tqdm module works a charm. Is there something similar for saving? The code looks like:

    writer = pd.ExcelWriter(os.path.join(output_folder,"output.xlsx"),
                        strings_to_numbers=True)
    final_df.to_excel(writer, header=True, index=False)
    tqdm_gui.pandas(desc="Saving progress")
    writer.save()

riemann_lebesgue
  • 299
  • 5
  • 17
  • Does this answer your question? [Is it possible to use tqdm for a process that isn't a loop?](https://stackoverflow.com/questions/60321252/is-it-possible-to-use-tqdm-for-a-process-that-isnt-a-loop) – crissal Aug 24 '21 at 14:48
  • the chunk size works for concat but not for .save - although perhaps the thread would work – riemann_lebesgue Aug 24 '21 at 15:52
  • but you'd have to know how far to loop through in advance, although perhaps it would provide a partial solution – riemann_lebesgue Aug 24 '21 at 15:58

0 Answers0