Easy-to-see tqdm on the Jupyter notebook
I installed tqdm to see progress bars in the Jupyter notebook.
However when I use tqdm normally for nested “for statements”, full of progress bars are displayed….
So, this post is about a way to make tqdm on the Jupyter notebook easier to see.
I have installed tqdm with pip in the terminal (because I manage packages with pip).
pip install tqdm
full of progress bars…
from tqdm import tqdm
Using tqdm normally for nested “for statements”, it seems to be output every time the situation is updated, so it is hard to see because it comes out in a row….Oh my….
Use tqdm.notebook to avoid clutter
Just use tqdm.notebook instead of normal tqdm.
from tqdm.notebook import tqdm
It becomes much easier to see and look better.
Adding “leave = False”, it will be more simple-looking.
As a side note, in order to use tqdm with pandas data, just type;
It seems to use tqdm.notebook now
It seems that tqdm_notebook have been used until a while ago, so even on the sites I referred to,
from tqdm import tqdm_notebook as tqdm
But as use of tqdm_notebook, the following warning will appear.
TqdmDeprecationWarning: This function will be removed in tqdm==5.0.0 Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`
Although we can still run tqdm_notebook,
it has updated(replaced?) to tqdm.notebook at some point, and tqdm_notebook will be removed in ver.5.0.0….
When HBox…. appear and the progress bar does not appear
On running with tqdm,
HBox(children=(FloatProgress(value=0.0, description='1st loop', max=4.0, style=ProgressStyle(description_width…
encounter something like this and the progress bar does not appear, it seems that the settings in ipywidgets are not enough.
To solve this, install ipywidgets with
pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension
and launch the Jupyter notebook.
In my case, I was told that there was no wheel, so I added wheel with pip.
pip install wheel
Now it works fine.
I’m glad it’s a little more comfortable.
Jupyter ; 1.0.0
macOS; Catalina version 10.15.4
The sites that I mainly referred to. Thank you very much.
wpX Speed / wpX