Better Pandas¶
This section cover tools to make your experience with Pandas a litte bit better.
tqdm: Add Progress Bar to Your Pandas Apply¶
!pip install tqdm
If you want to have a progress bar to get updated about the progress of your pandas apply, try tqdm.
import pandas as pd
from tqdm import tqdm
import time
df = pd.DataFrame({'a': [1, 2, 3, 4, 5], 'b': [2, 3, 4, 5, 6]})
tqdm.pandas()
def func(row):
time.sleep(1)
return row + 1
df['a'].progress_apply(func)
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:05<00:00, 1.00s/it]
0 2
1 3
2 4
3 5
4 6
Name: a, dtype: int64