code: def calc_common_dist(df):
    '''
    calculate a common distribution (for col qn only) that will be used to qn
    '''
  
    # axis is col
    tmp_arr = np.array([])
  
    col_names = df.columns.tolist()
  
    for inst_col in col_names:
  
      # sort column
      tmp_vect = df[inst_col].sort_values(ascending=False).values
  
      # stacking rows vertically (will transpose)
      if tmp_arr.shape[0] == 0:
        tmp_arr = tmp_vect
      else:
        tmp_arr = np.vstack((tmp_arr, tmp_vect))
  
    tmp_arr = tmp_arr.transpose()
  
    common_dist = tmp_arr.mean(axis=1)
  
    return common_disf calc_common_dist(df):
    '''
    calculate a common distribution (for col qn only) that will be used to qn
    '''
  
    # axis is col
    tmp_arr = np.array([])
  
    col_names = df.columns.tolist()
  
    for inst_col in col_names:
  
      # sort column
      tmp_vect = df[inst_col].sort_values(ascending=False).values
  
      # stacking rows vertically (will transpose)
      if tmp_arr.shape[0] == 0:
        tmp_arr = tmp_vect
      else:
        tmp_arr = np.vstack((tmp_arr, tmp_vect))
  
    tmp_arr = tmp_arr.transpose()
  
    common_dist = tmp_arr.mean(axis=1)
  
    return common_dist
docs: calculate a common distribution (for col qn only) that will be used to qn