code: def get_daily_bin_group(bench_values, stock_values, group_n):
      """get_daily_bin_group
      Group the values of the stocks of benchmark into several bins in a day.
      Put the stocks into these bins.
  
      :param bench_values: A series contains the value of stocks in benchmark.
                           The index is the stock code.
      :param stock_values: A series contains the value of stocks of your portofolio
                           The index is the stock code.
      :param group_n:      Bins will be produced
  
      :return:             A series with the same size and index as the stock_value.
                           The value in the series is the group id of the bins.
                           The No.1 bin contains the biggest values.
      """
      stock_group = stock_values.copy()
  
      # get the bin split points based on the daily proportion of benchmark
      split_points = np.percentile(
          bench_values[~bench_values.isna()],
          np.linspace(0, 100, group_n + 1),
      )
      # Modify the biggest uppper bound and smallest lowerbound
      split_points[0], split_points[-1] = -np.inf, np.inf
      for i, (lb, up) in enumerate(zip(split_points, split_points[1:])):
          stock_group.loc[
              stock_values[
                  (stock_values >= lb) & (stock_values < up)
              ].index
          ] = (group_n - i)
      return stock_group
  
file_path: qlib/qlib/backtest/profit_attribution.py
imports: import datetime
  from pathlib import Path
  import numpy
  import pandas
  from ..config import C
  from ..data import D
  from .position import Position
label_desc: Use image node_id 5 for calling a global function with example usage: get_daily_bin_group(bench_values, stock_values, group_n) and returns: stock_group