code: def calc_long_short_return(
      pred: pd.Series,
      label: pd.Series,
      date_col: str = "datetime",
      quantile: float = 0.2,
      dropna: bool = False,
  ) -> Tuple[pd.Series, pd.Series]:
      """
      calculate long-short return
  
      Note:
          `label` must be raw stock returns.
  
      Parameters
      ----------
      pred : pd.Series
          stock predictions
      label : pd.Series
          stock returns
      date_col : str
          datetime index name
      quantile : float
          long-short quantile
  
      Returns
      ----------
      long_short_r : pd.Series
          daily long-short returns
      long_avg_r : pd.Series
          daily long-average returns
      """
      df = pd.DataFrame({"pred": pred, "label": label})
      if dropna:
          df.dropna(inplace=True)
      group = df.groupby(level=date_col)
  
      def N(x):
          return int(len(x) * quantile)
  
      r_long = group.apply(
          lambda x: x.nlargest(N(x), columns="pred").label.mean()
      )
      r_short = group.apply(
          lambda x: x.nsmallest(N(x), columns="pred").label.mean()
      )
      r_avg = group.label.mean()
      return (r_long - r_short) / 2, r_avg
  
file_path: qlib/qlib/contrib/eva/alpha.py
imports: import pandas
  from typing import Tuple
  from qlib import get_module_logger
  from qlib.utils.paral import complex_parallel, DelayedDict
  from joblib import Parallel, delayed
label_desc: Use image node_id 2 for calling a global function with example usage: calc_long_short_return(pred, label, date_col, quantile, dropna) and returns: unknown,  r_avg, int