tqdm in Jupyter Notebook prints new progress bars repeatedly

后端 未结 8 774
粉色の甜心
粉色の甜心 2020-12-04 06:33

I am using tqdm to print progress in a script I\'m running in a Jupyter notebook. I am printing all messages to the console via tqdm.write(). Howev

8条回答
  •  失恋的感觉
    2020-12-04 07:12

    If the other tips here don't work and - just like me - you're using the pandas integration through progress_apply, you can let tqdm handle it:

    from tqdm.autonotebook import tqdm
    tqdm.pandas()
    
    df.progress_apply(row_function, axis=1)
    

    The main point here lies in the tqdm.autonotebook module. As stated in their instructions for use in IPython Notebooks, this makes tqdm choose between progress bar formats used in Jupyter notebooks and Jupyter consoles - for a reason still lacking further investigations on my side, the specific format chosen by tqdm.autonotebook works smoothly in pandas, while all others didn't, for progress_apply specifically.

提交回复
热议问题