Tqdm 是一个快速,可扩展的Python进度条,可以在 Python 长循环中添加一个进度提示信息,用户只需要封装任意的迭代器 tqdm(iterator)。
text = ""
for char in tqdm(["a", "b", "c", "d"]):
text = text + char
time.sleep(0.5)
for i in trange(100):
time.sleep(0.1)
pbar = tqdm(["a", "b", "c", "d"])
for char in pbar:
pbar.set_description("Processing %s" % char)
with tqdm(total=100) as pbar:
for i in range(10):
pbar.update(10)
pbar = tqdm(total=100)
for i in range(10):
pbar.update(10)
pbar.close()
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randint(0, 100, (10000000, 6)))
tqdm.pandas(desc="my bar!")
df.progress_apply(lambda x: x**2)
class tqdm(object):
"""
Decorate an iterable object, returning an iterator which acts exactly
like the original iterable, but prints a dynamically updating
progressbar every time a value is requested.
"""
def __init__(self, iterable=None, desc=None, total=None, leave=True,
file=None, ncols=None, mininterval=0.1,
maxinterval=10.0, miniters=None, ascii=None, disable=False,
unit='it', unit_scale=False, dynamic_ncols=False,
smoothing=0.3, bar_format=None, initial=0, position=None,
postfix=None):
https://blog.csdn.net/zkp_987/article/details/81748098
https://blog.csdn.net/qq_40666028/article/details/79335961