code: def quantile_turnover(quantile_factor, quantile, period=1):
      """
      Computes the proportion of names in a factor quantile that were
      not in that quantile in the previous period.
  
      Parameters
      ----------
      quantile_factor : pd.Series
          DataFrame with date, asset and factor quantile.
      quantile : int
          Quantile on which to perform turnover analysis.
      period: int, optional
          Number of days over which to calculate the turnover.
  
      Returns
      -------
      quant_turnover : pd.Series
          Period by period turnover for that quantile.
      """
  
      quant_names = quantile_factor[quantile_factor == quantile]
      quant_name_sets = quant_names.groupby(level=["date"]).apply(
          lambda x: set(x.index.get_level_values("asset"))
      )
  
      name_shifted = quant_name_sets.shift(period)
  
      new_names = (quant_name_sets - name_shifted).dropna()
      quant_turnover = new_names.apply(
          lambda x: len(x)
      ) / quant_name_sets.apply(lambda x: len(x))
      quant_turnover.name = quantile
      return quant_turnover
  
imports: import pandas
  import numpy
  import warnings
  import empyrical
  from pandas.tseries.offsets import BDay
  from scipy import stats
  from statsmodels.regression.linear_model import OLS
  from statsmodels.tools.tools import add_constant
  from .None import utils
label_desc: Use image node_id 10 for calling a global function with example usage: quantile_turnover(quantile_factor, quantile, period) and returns: quant_turnover