https://pypi.org/project/progress/
https://github.com/tqdm/tqdm
https://stackoverflow.com/questions/3160699/python-progress-bar?page=1&tab=votes#tab-top
# Progress
from time import sleep
from progress.bar import Bar
with Bar('Processing...') as bar:
for i in range(100):
sleep(0.02)
bar.next()
from time import sleep
from progress.bar import Bar
with Bar('Loading', fill='@', suffix='%(percent).1f%% - %(eta)ds') as bar:
for i in range(100):
sleep(0.02)
bar.next()
from time import sleep
from progress.spinner import MoonSpinner
with MoonSpinner('Processing…') as bar:
for i in range(100):
sleep(0.02)
bar.next()
# Progressbar2
from time import sleep
from progressbar import progressbar
for i in progressbar(range(100)):
sleep(0.02)
from time import sleep
from progress.bar import Bar
with Bar('Processing',max = 5) as bar:
for i in range(5):
sleep(0.1)
print('\n',i)
bar.next()
from time import sleep
from progressbar import progressbar
for i in progressbar(range(100), redirect_stdout=True):
print('Some text', i)
sleep(0.1)
# Alive-Progress
from alive_progress import alive_bar
from time import sleep
with alive_bar(100) as bar: # default setting
for i in range(100):
sleep(0.03)
bar() # call after consuming one item
# using bubble bar and notes spinner
with alive_bar(200, bar = 'bubbles', spinner = 'notes2') as bar:
for i in range(200):
sleep(0.03)
bar()
# TQDM
from tqdm import tqdm
from time import sleep
for i in tqdm(range(100)):
sleep(0.02)
import pandas as pd
import numpy as np
from tqdm import tqdm
df = pd.DataFrame(np.random.randint(0, 1000, (100000, 600)))
tqdm.pandas(desc="my bar!")
df.progress_apply(lambda x: x**2)
评论
发表评论