Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
249 views
in Technique[技术] by (71.8m points)

python - Too broad space between tqdm progress bar

When using tqdm in jupyter notebook, spaces between each progress bar in result are so broad. How to decrease the space?

for i in tqdm(range(10)): pass
for i in tqdm(range(10)): pass
for i in tqdm(range(10)): pass
for i in tqdm(range(10)): pass

enter image description here

question from:https://stackoverflow.com/questions/65879873/too-broad-space-between-tqdm-progress-bar

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Although I cannot reproduce this in my environment, it looks like tqdm is trying to use a height of 20 rows to display the status bars. The parameter connected to this is "nrows" (see documentation of its init method) Here, the default fallback value is 20 rows (which would fit to your experience). Try adapting it accordingly, e.g.:

from tqdm import tqdm
for i in tqdm(range(10), nrows=4): pass
for i in tqdm(range(10), nrows=4): pass
for i in tqdm(range(10), nrows=4): pass
for i in tqdm(range(10), nrows=4): pass

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...