def get_top_drawdowns(returns, top=<NUM_LIT:10>):
returns = returns.copy()<EOL>df_cum = ep.cum_returns(returns, <NUM_LIT:1.0>)<EOL>running_max = np.maximum.accumulate(df_cum)<EOL>underwater = df_cum / running_max - <NUM_LIT:1><EOL>drawdowns = []<EOL>for t in range(top):<EOL><INDENT>peak, valley, recovery = get_max_drawdown_underwater(underwater)<EOL>if not pd.isnull(recovery):<EOL><INDENT>underwater.drop(underwater[peak: recovery].index[<NUM_LIT:1>:-<NUM_LIT:1>],<EOL>inplace=True)<EOL><DEDENT>else:<EOL><INDENT>underwater = underwater.loc[:peak]<EOL><DEDENT>drawdowns.append((peak, valley, recovery))<EOL>if (len(returns) == <NUM_LIT:0>) or (len(underwater) == <NUM_LIT:0>):<EOL><INDENT>break<EOL><DEDENT><DEDENT>return drawdowns<EOL>
Finds top drawdowns, sorted by drawdown amount.

Parameters
----------
returns : pd.Series
    Daily returns of the strategy, noncumulative.
     - See full explanation in tears.create_full_tear_sheet.
top : int, optional
    The amount of top drawdowns to find (default 10).

Returns
-------
drawdowns : list
    List of drawdown peaks, valleys, and recoveries. See get_max_drawdown.