tqdm module allows for the generation of progress bars in Python. The name is derived from the Arabic word, “taqaddum,” which translates as “progress.” It is designed to have minimal overhead, using algorithms to predict the remaining time and to skip unnecessary iteration displays. It has about a 60ns (nanoseconds) overhead per iteration whereas other progress bar implementations can run an 800ns overhead per iteration.
tqdm does not require any dependencies.
tqdmrequires an environment that supports carriage return (
\r) and line feed (
\n) control characters.
tqdm can be installed with the following pip command:
pip install tqdm
The most straightforward way to use
tqdm is to wrap the
tqdm() function around any iterable:
from tqdm import tqdmfrom time import sleeptotal = 0for num in tqdm([1, 2, 3, 4]):sleep(0.25)total = total + numprint("done")
This results in output like the following:
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.