Search code examples
pythonfor-looptqdm

tqdm for a For Loop in Python


I am using tqdm to track progress for a for loop in python.

import numpy as np
from tqdm import tqdm 

x = np.arange(20000000)

x_30 = []

for _x in tqdm(x):
    x_30.append(_x**30)

The progress bar looks like the following.

enter image description here

Can you please explain the progress bar for me? I don't really understand it.


Solution

  • The format of the bar is

    {progress in percentage} | {bar} | {processed}/{total} [{elapsed time}<{remaining time}, {number of iterations per seconds} it/s]
    

    You can find further information in the documentation, under bar_format.