df = pd.DataFrame(data={'returns': np.random.normal(0.001, 0.05, 1000)},
    index=pd.date_range(start=date(2016, 1, 1), periods=1000, freq='D'))
df = pd.DataFrame(data={'returns': np.random.normal(0.001, 0.05, 1000)},
    index=pd.date_range(start=date(2016, 1, 1), periods=1000, freq='D'))
df['cumulative_return'] = df.returns.add(1).cumprod().subtract(1)
df['max_drawdown'] = df.cumulative_return.add(1).div(df.cumulative_return.
    cummax().add(1)).subtract(1)
Calculate max draw down with a vectorized solution in python