When you are programming, handling a large amount of data, or repeating processing, you may be wondering "how long is it finished now?" Then it becomes a little confusing. Therefore, I will show you how to use the progress bar used when installing the application with Jupyter Notebook.
python
from IPython.html.widgets import FloatProgress
from IPython.display import display
from time import sleep
fp = FloatProgress(min=0, max=100)
display(fp)
for i in xrange(100):
sleep(0.1)
fp.value = i
python
from IPython.html.widgets import FloatProgress
from IPython.display import display
from time import sleep
fp = FloatProgress(min=0, max=100)
display(fp)
for i in range(100):
sleep(0.1)
fp.value = i
Postscript.
ShimWarning: The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.
"`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)
If the warning "..." is displayed, fix it as follows.
python
from ipywidgets import FloatProgress
from IPython.display import display
from time import sleep
fp = FloatProgress(min=0, max=100)
display(fp)
for i in range(100):
sleep(0.1)
fp.value = i
that's all.
Recommended Posts