Oblomov
Oblomov

Reputation: 9655

progress bar update in the same line of a jupyter notebook

I love the tqdm progress bar for its simplicity. I have noted however that there are cases, where each update of the progress bar is printed in a new line of a jupyter notebook like in the following screenshot:

tqdm progress update in newline

How can I make sure that the update of a tqdm progress bar is printed in the same line in a jupyter notebook like in the following screenshot:

enter image description here

?

Upvotes: 5

Views: 1789

Answers (1)

rrcal
rrcal

Reputation: 3752

tqdm has a specific module for handling the output in jupyter notebook, tqdm_notebook:

import time
from tqdm import tqdm_notebook as tqdm

for i in tqdm(range(10)):
   time.sleep(1)

Upvotes: 3

Related Questions