def gen_drawdown_table(returns, top=<NUM_LIT:10>):
df_cum = ep.cum_returns(returns, <NUM_LIT:1.0>)<EOL>drawdown_periods = get_top_drawdowns(returns, top=top)<EOL>df_drawdowns = pd.DataFrame(index=list(range(top)),<EOL>columns=['<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'])<EOL>for i, (peak, valley, recovery) in enumerate(drawdown_periods):<EOL><INDENT>if pd.isnull(recovery):<EOL><INDENT>df_drawdowns.loc[i, '<STR_LIT>'] = np.nan<EOL><DEDENT>else:<EOL><INDENT>df_drawdowns.loc[i, '<STR_LIT>'] = len(pd.date_range(peak,<EOL>recovery,<EOL>freq='<STR_LIT:B>'))<EOL><DEDENT>df_drawdowns.loc[i, '<STR_LIT>'] = (peak.to_pydatetime()<EOL>.strftime('<STR_LIT>'))<EOL>df_drawdowns.loc[i, '<STR_LIT>'] = (valley.to_pydatetime()<EOL>.strftime('<STR_LIT>'))<EOL>if isinstance(recovery, float):<EOL><INDENT>df_drawdowns.loc[i, '<STR_LIT>'] = recovery<EOL><DEDENT>else:<EOL><INDENT>df_drawdowns.loc[i, '<STR_LIT>'] = (recovery.to_pydatetime()<EOL>.strftime('<STR_LIT>'))<EOL><DEDENT>df_drawdowns.loc[i, '<STR_LIT>'] = (<EOL>(df_cum.loc[peak] - df_cum.loc[valley]) / df_cum.loc[peak]) * <NUM_LIT:100><EOL><DEDENT>df_drawdowns['<STR_LIT>'] = pd.to_datetime(df_drawdowns['<STR_LIT>'])<EOL>df_drawdowns['<STR_LIT>'] = pd.to_datetime(df_drawdowns['<STR_LIT>'])<EOL>df_drawdowns['<STR_LIT>'] = pd.to_datetime(<EOL>df_drawdowns['<STR_LIT>'])<EOL>return df_drawdowns<EOL>
Places top drawdowns in a table.

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
-------
df_drawdowns : pd.DataFrame
    Information about top drawdowns.