Analytics Vidhya
Published in

Analytics Vidhya

Photo by Gaelle Marcel on Unsplash

Python Tips — Show Progress Bar using TQDM

Have you ever wished to see a progress bar in Jupyter Notebook when executing a complex function in for loop?

Its possible in Python.

There is a package tqdm which allows us to show progress bar.
Also it is simple to use!!!

While implementing a for loop wrap around the iterable object using the function tqdm to show the progress of the for loop execution.

Lets see how to do it.

As we are going to use a simple for loop of 10 numbers using range(), lets use a sleep method to slower the process. So that we can see the use of progress bar.

from tqdm import tqdm 
from time import sleep
sum = 0
for i in tqdm(range(10)):
sum = sum + i

Another example with list object:

st = '' 
for char in tqdm(['a', 'b', 'c', 'd', 'e']):
st = st + char

Add a description to the progress bar:

st = '' 
for char in tqdm(['a', 'b', 'c', 'd', 'e'], desc = 'Concatenating Characters'):
st = st + char

Hope you enjoyed the learning.

For more information on using tqdm and to customize the progress bar, please refer their documentation here (,

We will meet with a new tip in Python. Thank you! 👍

Like to support? Just click the clap icon ❤️.

Happy Programming!🎈

Originally published at on October 17, 2020.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store