code: def rolling_beta(
      returns, factor_returns, rolling_window=APPROX_BDAYS_PER_MONTH * 6
  ):
      """
      Determines the rolling beta of a strategy.
  
      Parameters
      ----------
      returns : pd.Series
          Daily returns of the strategy, noncumulative.
           - See full explanation in tears.create_full_tear_sheet.
      factor_returns : pd.Series or pd.DataFrame
          Daily noncumulative returns of the benchmark factor to which betas are
          computed. Usually a benchmark such as market returns.
           - If DataFrame is passed, computes rolling beta for each column.
           - This is in the same style as returns.
      rolling_window : int, optional
          The size of the rolling window, in days, over which to compute
          beta (default 6 months).
  
      Returns
      -------
      pd.Series
          Rolling beta.
  
      Note
      -----
      See https://en.wikipedia.org/wiki/Beta_(finance) for more details.
      """
  
      if factor_returns.ndim > 1:
          # Apply column-wise
          return factor_returns.apply(
              partial(rolling_beta, returns),
              rolling_window=rolling_window,
          )
      else:
          out = pd.Series(index=returns.index)
          for beg, end in zip(
              returns.index[0:-rolling_window],
              returns.index[rolling_window:],
          ):
              out.loc[end] = ep.beta(
                  returns.loc[beg:end], factor_returns.loc[beg:end]
              )
  
          return out
  
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 19 for calling a global function with example usage: rolling_beta(returns, factor_returns, rolling_window) and returns: factor_returns, out