code: def test_gen_drawdown_table_relative(
      self,
      px,
      first_expected_peak,
      first_expected_valley,
      first_expected_recovery,
      first_net_drawdown,
      second_expected_peak,
      second_expected_valley,
      second_expected_recovery,
      second_net_drawdown,
  ):
      rets = px.pct_change()
  
      drawdowns = timeseries.gen_drawdown_table(rets, top=2)
  
      self.assertEqual(
          np.round(drawdowns.loc[0, "Net drawdown in %"]),
          first_net_drawdown,
      )
      self.assertEqual(
          drawdowns.loc[0, "Peak date"], first_expected_peak
      )
      self.assertEqual(
          drawdowns.loc[0, "Valley date"], first_expected_valley
      )
      self.assertEqual(
          drawdowns.loc[0, "Recovery date"], first_expected_recovery
      )
  
      self.assertEqual(
          np.round(drawdowns.loc[1, "Net drawdown in %"]),
          second_net_drawdown,
      )
      self.assertEqual(
          drawdowns.loc[1, "Peak date"], second_expected_peak
      )
      self.assertEqual(
          drawdowns.loc[1, "Valley date"], second_expected_valley
      )
      self.assertTrue(pd.isnull(drawdowns.loc[1, "Recovery date"]))
  
imports: from __future__ import division
  import os
  from unittest import TestCase
  from nose_parameterized import parameterized
  from numpy.testing import assert_allclose, assert_almost_equal
  from pandas.util.testing import assert_series_equal
  import numpy
  import pandas
  from ..None import timeseries
  from pyfolio.utils import to_utc, to_series
  import gzip
label_desc: Use image node_id 2 for calling the TestDrawdown obj's underlying member method code with example usage: obj.test_gen_drawdown_table_relative(px, first_expected_peak, first_expected_valley, first_expected_recovery, first_net_drawdown, second_expected_peak, second_expected_valley, second_expected_recovery, second_net_drawdown) without return types