tqdm
支持 pandas 合并操作的进度条。
取自这个问题的代码,here https://stackoverflow.com/questions/56256861/is-it-possible-to-use-tqdm-for-pandas-merge-operation
import pandas as pd
from tqdm import tqdm
df1 = pd.DataFrame({'lkey': 1000*['a', 'b', 'c', 'd'],'lvalue': np.random.randint(0,int(1e8),4000)})
df2 = pd.DataFrame({'rkey': 1000*['a', 'b', 'c', 'd'],'rvalue': np.random.randint(0, int(1e8),4000)})
#this is how you activate the pandas features in tqdm
tqdm.pandas()
#call the progress_apply feature with a dummy lambda
df1.merge(df2, left_on='lkey', right_on='rkey').progress_apply(lambda x: x)
对于您的代码以及导入,它应该是:
tqdm.pandas()
merge = energydata.merge(dwellingData, left_on = "matrikkel2019", right_on="matrikkel2019").progress_apply(lambda x: x)