Easy Python Progress Bars with tqdm

  Рет қаралды 44,207

Rob Mulla

Rob Mulla

Күн бұрын

In this python progress bar tutorial we go in depth about TQDM in this complete guide. The progress bar package tqdm is extremely helpful for any python programmer. Rob Mulla discusses why this package is so helpful and how you can customize it to do much more than just track the progress of a loop. After watching the video you will have learned something new to improve your python and data science coding and efficiency when evaluating your code's progress. Tqdm can be used in a jupyter notebook, command line and disabled easily.
Timeline
00:00 Intro
01:04 Setup
02:09 Tqdm Basics
06:01 Advanced Configs
09:00 Custom Interval
09:48 Disabling tqdm
10:35 Tqdm and Pandas
11:59 tqdm notebook
13:50 Read the docs
Follow me on twitch for live coding streams: / medallionstallion_
My other videos:
Speed Up Your Pandas Code: • Make Your Pandas Code ...
Speed up Pandas Code: • Make Your Pandas Code ...
Intro to Pandas video: • A Gentle Introduction ...
Exploritory Data Analysis Video: • Exploratory Data Analy...
Working with Audio data in Python: • Audio Data Processing ...
Efficient Pandas Dataframes: • Speed Up Your Pandas D...
* KZbin: youtube.com/@robmulla?sub_con...
* Discord: / discord
* Twitch: / medallionstallion_
* Twitter: / rob_mulla
* Kaggle: www.kaggle.com/robikscube
#python #datascience #tqdm

Пікірлер: 63
@OmegaRxNeo
@OmegaRxNeo 2 жыл бұрын
The best explanation about tqdm in the internet. Direct to the point and with easy explanations! Please continue sharing your knowledge. I found your channel looking for data analysis in Python, and really enjoy your content. Cheer's from Brazil!!!!
@robmulla
@robmulla 2 жыл бұрын
Thanks so much for the feedback. That really means a lot to me.😊
@aleks_shcherbakov
@aleks_shcherbakov Жыл бұрын
Rob, thank you so much for your hard work and contribution to the development of the data analyst community! From Russia with love!
@daytodatainc
@daytodatainc 10 ай бұрын
Great explanation with practical examples. Thanks!!
@ritvikrastogi4912
@ritvikrastogi4912 2 жыл бұрын
Hi Rob, warm greetings from India I got to know about your channel when you did a live stream on Abhishek Thakur's channel I've been following you since then and I really like your content, especially how you make it so easy to understand and yet it's still in-depth and cover most of the concepts about that topic I just have one little request please make some tutorials on advanced topics as well like Transformers, Auto encoders etc
@ramonbr66
@ramonbr66 Жыл бұрын
Excelent video! Thank you, Rob.
@robmulla
@robmulla Жыл бұрын
Appreciate the kind words. Thanks for watching.
@mateusbalotin7247
@mateusbalotin7247 2 жыл бұрын
Thanks for the video!! Hope you have a great week.
@robmulla
@robmulla 2 жыл бұрын
Thanks for watching!
@ignatiusezeani6816
@ignatiusezeani6816 6 ай бұрын
Thanks so much for this insightful video.🙏
@IntelliTradeBot
@IntelliTradeBot Жыл бұрын
Thank you, sir.. learning from a Pro is a much better option than reading through the help manual.
@irfanshaikh262
@irfanshaikh262 Жыл бұрын
@Rob Thanks a tonn for this video. Its really helpful.
@robmulla
@robmulla Жыл бұрын
Glad it was helpful for you. Like & share with all your friends!
@prasannakukade300
@prasannakukade300 2 жыл бұрын
Very smooth explanation...
@robmulla
@robmulla 2 жыл бұрын
Thanks! Glad you found it helpful.
@minhnguyenquang6248
@minhnguyenquang6248 Жыл бұрын
It's great, thanks bro!
@robmulla
@robmulla Жыл бұрын
Thanks for watching!
@robmulla
@robmulla 2 жыл бұрын
Here is a gist with the code from the tutorial if you would like to try it yourself: gist.github.com/RobMulla/0fe4acf99001d4657df4e73c93cf3218
@1811artur
@1811artur Ай бұрын
very usefull
@vydo4210
@vydo4210 Жыл бұрын
This tutorial is very good.
@robmulla
@robmulla Жыл бұрын
Thanks Vy!
@tutosolve
@tutosolve Жыл бұрын
Nice video . From Vietnam
@robmulla
@robmulla Жыл бұрын
Thanks for watching!
@7686Jin
@7686Jin Күн бұрын
Great tutorial! Btw how do I update the progress bar if im using multiprocessing?
@aaronjenkins223
@aaronjenkins223 12 күн бұрын
Is there a way i can make a progress bar that tracks sub loops? I have a function that loops through Members, and for each member loops through assignments and then writes to a file. Is there a way to have it track every time it writes to the file without having to be in the bottom loop? As it is if i put it on the members it just updates x% after each member and the time remaining is way off because some have a lot more assignments than others.
@89Sawik
@89Sawik Жыл бұрын
It would be great to hear some of your thoughts on progress bar for multiprocessing stuff. For me it was a real pain in the back to make it work xD
@robmulla
@robmulla Жыл бұрын
Yea, nested tqdm bars can be annoying. Sometimes it's best to test on a subset of the data and then disable them for the actual run.
@89Sawik
@89Sawik Жыл бұрын
@@robmulla i meant traking progress of calculations spread between multiple processes by means id multiprocessing package. I ended up manually updating progress bar after checking number of items in shared queue.
@vivekjoshi3769
@vivekjoshi3769 10 ай бұрын
Hi First of all thank you for sharing this. I have some doubt. When I use sleep(0.00001) like you under for dogs loop with 50000 iterations, it's taking more than 5 minutes to run but in your case I see it ran under 2 minutes. May I know why is it faster in your case but slower in mine? I am using VS code for running this. I am talking about the part at 02:50 Please clarify.
@mtamjidhossain
@mtamjidhossain 2 жыл бұрын
Nice video, do you mind sharing what theme are you using for jupyter notebook?
@robmulla
@robmulla 2 жыл бұрын
Thanks for the feedback. I'm using the Nord theme which can be installed from here: github.com/arbennett/jupyterlab-themes there are a lot of other good ones too.
@binotabao7278
@binotabao7278 Жыл бұрын
Love your helpful videos. Could you show me the way to set up the underline Separator (_) for a number when typing in code cell, for example 50_000. Thank you.
@robmulla
@robmulla Жыл бұрын
Basically in the newer versions of python you can add _ to any integer and not have an issue. I like to use them to make large numbers easier to read. 1000000 becomes 1_000_000
@GeoffryGifari
@GeoffryGifari 3 ай бұрын
Can tqdm be initialized _inside_ a loop? so without specifying the iterable's length first
@nerassurdo
@nerassurdo Жыл бұрын
Can you please show an example of how you would implement this for scikit-learn when doing a RandomForest or XGBoost model and you're hyper-parameter tuning?
@robmulla
@robmulla Жыл бұрын
If you are using something like random grid search or grid search in sklearn - it essentially provides a generator object which you iterate over. You simply need to wrap that generator with tqdm and have a total= the number of iterations you will run. Check out this walkthrough looks to have a good example: www.jpytr.com/post/lazy_tuning/
@nerassurdo
@nerassurdo Жыл бұрын
@@robmulla Thank you... that looks surprisingly simple, though they did not have the "total=" portion that you mention. By the way, what is your favorite way to tune hyper-parameters since you linked to this "lazy tuning" article? I read about Halving Grid Search recently. Wondering if there's better ways you came across in your experience.
@telmomachado1490
@telmomachado1490 2 жыл бұрын
Could you make a video teaching how to generate combination number and saving in Excel? and at each end of the 1048576 line it generates a new excel. I have an excel generator but it creates in folders on the side, inside the same file so it is very heavy, but if you make a file in each folder, it would be ideal. like the mega sena, and instead of generating all the possibilities, leave a field to generate combinations only with the numbers that we would prefer. here's the tip. it would be great, thanks.
@robmulla
@robmulla 2 жыл бұрын
Hey Telmo. Thanks for writing this comment. This sounds like a very specific case and I’m not sure I follow exactly what you are looking to do. It might be something you could have better luck asking on my discord? Hope you figure out a good solution.
@dingaroo2003
@dingaroo2003 Жыл бұрын
Hi Rob, greetings from Singapore! I am coding following along with the video, but the section on TQDM and Pandas, doesn't seem to work for me. Both scenarios are a no go for me. Please enlighten. Thank you very much in advance. PS: I find your shorts and videos very helpful, helping me fall asleep, or rather, keeping me away, thinking how I can integrate into my code portfolio!
@robmulla
@robmulla Жыл бұрын
Glad you've found my videos helpful. I'm not sure what exactly your issue is. Sometimes you need to provide the total=len(df) to get tqdm to work correctly on dataframes. Hope that helps.
@RafaelCataldo
@RafaelCataldo Жыл бұрын
Thanks for the lesson, sir. I have one question. I defined a function and used the tqdm in it. When I call this function from a .py file, the tqdm does not get recognized, even importing as you shown it here. Do you have any clue how to solve this issue? When I define the function in a cell and then I call it, it works! But the functions are too big and, thus, I wanted it to keep on the .py file I'm using to call some functions when need it. Thanks for your time.
@robmulla
@robmulla Жыл бұрын
Hi. Thanks for the comment. Have you made sure to import tqdm at the top of your .py file? It needs to be imported in the file where it is called. Hope that helps.
@RafaelCataldo
@RafaelCataldo Жыл бұрын
@@robmulla That was it! Thanks! Now I have a new problem to solve, but little by little I'll get there lol! Thanks again!
@robmulla
@robmulla Жыл бұрын
@@RafaelCataldo Glad you figured it out!
@escolaparapobres
@escolaparapobres 2 жыл бұрын
Hey, I'm Brazil, How to implement for current tasks?
@robmulla
@robmulla 2 жыл бұрын
Hey, thanks for watching. Not sure what you mean by current tasks. If you wrap your current loop in tqdm it will display a progress bar. Hope that helps.
@resresres1
@resresres1 Жыл бұрын
I would be impressed if tqdm could give a progress bar when reading a excel or csv file as a dataframe.
@robmulla
@robmulla Жыл бұрын
I think it can if you use chunking when reading. Pretty sure I’ve seen it before.
@resresres1
@resresres1 Жыл бұрын
@@robmulla hmm thanks for that comment about chunking. Found some interesting ideas regarding it. I assume it possible to use chunking with other types of libraries that load files? I have one program that uses pythonOCC library to load model .STL files, would love to get a progress bar for reading those files into the program.
@jessemutiga6055
@jessemutiga6055 2 жыл бұрын
Please sir, do a KeyWord Extraction video
@robmulla
@robmulla 2 жыл бұрын
Thanks for the feedback. I’ll see what I can do.
@jessemutiga6055
@jessemutiga6055 2 жыл бұрын
@@robmulla my humble request to you would be to expand the bert sentiment analysis video to include bert keyword extraction from the Amazon dataset - this would be phenomenal.
@tradertrader2649
@tradertrader2649 Жыл бұрын
how about `df.isnull().sum()` how can i use tqdm here
@robmulla
@robmulla Жыл бұрын
Not sure if you can because it's vectorized already.
@jasonsykes4199
@jasonsykes4199 2 жыл бұрын
I am trying to use "with torch.no_grad(): for idx, data in enumerate(tbar):" on my own code, but keep getting a " 0%| | 0/1 [00:00
@jasonsykes4199
@jasonsykes4199 2 жыл бұрын
tbar = tqdm(val_loader, file=sys.stdout)
@robmulla
@robmulla 2 жыл бұрын
Hey Jason. I’m not aware of any reason why it would work on Kaggle but not vscode. Are you using tqdm.auto? Maybe try forcing it to use the base tqdm?
@dingaroo2003
@dingaroo2003 Жыл бұрын
@@robmulla how do you do that?
@robmulla
@robmulla Жыл бұрын
@@dingaroo2003 from tqdm.auto import tqdm
@AnastasiaZvychaynaya
@AnastasiaZvychaynaya Жыл бұрын
Hello! I don't know why but I have an error: out = fake_df.groupby('dog').progress_apply(lambda row: int(row['smell'])**2) my bar: 67%|██████▋ | 2/3 [00:00
@robmulla
@robmulla Жыл бұрын
Sorry I don’t think I can fully debug this for you. But maybe try setting axis=1 in the apply?
@AnastasiaZvychaynaya
@AnastasiaZvychaynaya Жыл бұрын
@@robmulla Setting axis=1 doesn't help, the problem was that numpy.random.randint returns a string in my case (I really don't know why), whereas from documentation it has to be int. Interesting, but this is how a local program is executed (I used to do it in Colab). I simply converted 'smell' data to int. Anyway, thanks for you quick reply!
This INCREDIBLE trick will speed up your data processes.
12:54
Rob Mulla
Рет қаралды 261 М.
Make Your Pandas Code Lightning Fast
10:38
Rob Mulla
Рет қаралды 180 М.
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 101 МЛН
Я обещал подарить ему самокат!
01:00
Vlad Samokatchik
Рет қаралды 7 МЛН
DEFINITELY NOT HAPPENING ON MY WATCH! 😒
00:12
Laro Benz
Рет қаралды 64 МЛН
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН
25 Nooby Pandas Coding Mistakes You Should NEVER make.
11:30
Rob Mulla
Рет қаралды 264 М.
Exploratory Data Analysis with Pandas Python
40:22
Rob Mulla
Рет қаралды 448 М.
Modern Python logging
21:32
mCoding
Рет қаралды 167 М.
Streamlit Elements You Should Know About in 2023
14:31
Mısra Turp
Рет қаралды 92 М.
Get Started with Machine Learning and AI in 2023
9:47
Rob Mulla
Рет қаралды 25 М.
Professional Progress Bars in Python
10:49
NeuralNine
Рет қаралды 25 М.
Python dataclasses will save you HOURS, also featuring attrs
8:50
15 Python Libraries You Should Know About
14:54
ArjanCodes
Рет қаралды 377 М.
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 286 М.
ADVANCED Python AI Agent Tutorial - Using RAG
40:59
Tech With Tim
Рет қаралды 133 М.
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 101 МЛН