When we are applying a function to a big Data-Frame, we can’t see the progress of the function or an estimate on how long remains for the function to be applied to the whole dataset. We can solve this with the use of the tqdm library.
import pandas as pd import numpy as np from tqdm.notebook import tqdm tqdm.pandas()
#dummy data df=pd.DataFrame({"Value":np.random.normal(size=1500000)})
Let’s apply a simple function to our data but instead of using apply, we will use the progress_apply function.
df['Value'].progress_apply(lambda x: x**2)