def drawdown(return_series: pd.Series):
    'Takes a time series of asset returns.\n       returns a DataFrame with columns for\n       the wealth index, \n       the previous peaks, and \n       the percentage drawdown\n    '
    wealth_index = (1000 * (1 + return_series).cumprod())
    previous_peaks = wealth_index.cummax()
    drawdowns = ((wealth_index - previous_peaks) / previous_peaks)
    return pd.DataFrame({'Wealth': wealth_index, 'Previous Peak': previous_peaks, 'Drawdown': drawdowns})
Takes a time series of asset returns.
returns a DataFrame with columns for
the wealth index, 
the previous peaks, and 
the percentage drawdown
def drawdown(return_series: pd.Series):
    'Takes a time series of asset returns.\n       returns a DataFrame with columns for\n       the wealth index, \n       the previous peaks, and \n       the percentage drawdown\n    '
    wealth_index = (1000 * (1 + return_series).cumprod())
    previous_peaks = wealth_index.cummax()
    drawdowns = ((wealth_index - previous_peaks) / previous_peaks)
    return pd.DataFrame({'Wealth': wealth_index, 'Previous Peak': previous_peaks, 'Drawdown': drawdowns})