time df apply 28 29 python

Solutions on MaxInterview for time df apply 28 29 python by the best coders in the world

showing results for - "time df apply 28 29 python"
Niclas
16 May 2017
1import pandas as pd
2import numpy as np
3from tqdm import tqdm
4# from tqdm.auto import tqdm  # for notebooks
5
6df = pd.DataFrame(np.random.randint(0, int(1e8), (10000, 1000)))
7
8# Create and register a new `tqdm` instance with `pandas`
9# (can use tqdm_gui, optional kwargs, etc.)
10tqdm.pandas()
11
12# Now you can use `progress_apply` instead of `apply`
13df.groupby(0).progress_apply(lambda x: x**2)