docstr: Test varying factor asset universe: at different dates there might be
  different assets
docstr_tok: ["Test","varying","factor","asset","universe",":","at","different","dates","there","might","be","different","assets"]
code: def test_average_cumulative_return_by_quantile_2(
      self, before, after, demeaned, quantiles, expected_vals
  ):
      """
      Test varying factor asset universe: at different dates there might be
      different assets
      """
      dr = date_range(start="2015-1-15", end="2015-1-25")
      dr.name = "date"
      tickers = ["A", "B", "C", "D", "E", "F"]
      r1, r2, r3, r4 = (1.25, 1.50, 1.00, 0.50)
      data = [
          [r1**i, r2**i, r3**i, r4**i, r2**i, r3**i]
          for i in range(1, 12)
      ]
      prices = DataFrame(index=dr, columns=tickers, data=data)
      dr2 = date_range(start="2015-1-18", end="2015-1-21")
      dr2.name = "date"
      factor = DataFrame(
          index=dr2,
          columns=tickers,
          data=[
              [3, 4, 2, 1, nan, nan],
              [3, 4, 2, 1, nan, nan],
              [3, nan, nan, 1, 4, 2],
              [3, nan, nan, 1, 4, 2],
          ],
      ).stack()
  
      factor_data = get_clean_factor_and_forward_returns(
          factor,
          prices,
          quantiles=quantiles,
          periods=range(0, after + 1),
          filter_zscore=False,
      )
  
      avgrt = average_cumulative_return_by_quantile(
          factor_data, prices, before, after, demeaned
      )
      arrays = []
      for q in range(1, quantiles + 1):
          arrays.append((q, "mean"))
          arrays.append((q, "std"))
      index = MultiIndex.from_tuples(
          arrays, names=["factor_quantile", None]
      )
      expected = DataFrame(
          index=index,
          columns=range(-before, after + 1),
          data=expected_vals,
      )
      assert_frame_equal(avgrt, expected)
  
imports: from __future__ import division
  from unittest import TestCase
  from parameterized import parameterized
  from numpy import nan
  from pandas import Series, DataFrame, date_range, MultiIndex, Int64Index, Index, DatetimeIndex, Timedelta
  from pandas.tseries.offsets import BDay, Day, CDay
  from pandas.util.testing import assert_frame_equal, assert_series_equal
  from ..performance import factor_information_coefficient, mean_information_coefficient, mean_return_by_quantile, quantile_turnover, factor_rank_autocorrelation, factor_returns, factor_alpha_beta, cumulative_returns, factor_weights, common_start_returns, average_cumulative_return_by_quantile
  from ..utils import get_forward_returns_columns, get_clean_factor_and_forward_returns
label_desc: Use image node_id 12 for calling the PerformanceTestCase obj's underlying member method code with example usage: obj.test_average_cumulative_return_by_quantile_2(before, after, demeaned, quantiles, expected_vals) without return types