How do I implement a progress bar

后端 未结 5 406
遇见更好的自我
遇见更好的自我 2020-12-24 08:19

How do I implement a progress bar in jupyter-notebook?

I\'ve done this:

count = 0
max_count = 100
bar_width = 40
while count <= max_count:
    tim         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-24 08:27

    You can try tqdm. Example code:

    # pip install tqdm
    from tqdm import tqdm_notebook
    
    # works on any iterable, including cursors. 
    # for iterables with len(), no need to specify 'total'.
    for rec in tqdm_notebook(items, 
                             total=total, 
                             desc="Processing records"):
        # any code processing the elements in the iterable
        len(rec.keys())
    

    Demo: https://youtu.be/T0gmQDgPtzY

提交回复
热议问题