code: def gen_drawdown_table(returns, top=10):
      """
      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.
      """
  
      df_cum = ep.cum_returns(returns, 1.0)
      drawdown_periods = get_top_drawdowns(returns, top=top)
      df_drawdowns = pd.DataFrame(
          index=list(range(top)),
          columns=[
              "Net drawdown in %",
              "Peak date",
              "Valley date",
              "Recovery date",
              "Duration",
          ],
      )
  
      for i, (peak, valley, recovery) in enumerate(drawdown_periods):
          if pd.isnull(recovery):
              df_drawdowns.loc[i, "Duration"] = np.nan
          else:
              df_drawdowns.loc[i, "Duration"] = len(
                  pd.date_range(peak, recovery, freq="B")
              )
          df_drawdowns.loc[
              i, "Peak date"
          ] = peak.to_pydatetime().strftime("%Y-%m-%d")
          df_drawdowns.loc[
              i, "Valley date"
          ] = valley.to_pydatetime().strftime("%Y-%m-%d")
          if isinstance(recovery, float):
              df_drawdowns.loc[i, "Recovery date"] = recovery
          else:
              df_drawdowns.loc[
                  i, "Recovery date"
              ] = recovery.to_pydatetime().strftime("%Y-%m-%d")
          df_drawdowns.loc[i, "Net drawdown in %"] = (
              (df_cum.loc[peak] - df_cum.loc[valley]) / df_cum.loc[peak]
          ) * 100
  
      df_drawdowns["Peak date"] = pd.to_datetime(
          df_drawdowns["Peak date"]
      )
      df_drawdowns["Valley date"] = pd.to_datetime(
          df_drawdowns["Valley date"]
      )
      df_drawdowns["Recovery date"] = pd.to_datetime(
          df_drawdowns["Recovery date"]
      )
  
      return df_drawdowns
  
imports: from __future__ import division
  from collections import OrderedDict
  from functools import partial
  import empyrical
  import numpy
  import pandas
  import scipy
  import scipy.stats
  from sklearn import linear_model
  from .deprecate import deprecated
  from .interesting_periods import PERIODS
  from .txn import get_turnover
  from .utils import APPROX_BDAYS_PER_MONTH, APPROX_BDAYS_PER_YEAR
  from .utils import DAILY
label_desc: Use image node_id 30 for calling a global function with example usage: gen_drawdown_table(returns, top) and returns: df_drawdowns