nodes: 0, module; 1, function_definition; 2, function_name:find_bin; 3, parameters; 4, block; 5, identifier:self; 6, identifier:x; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, comment:"""
          Sort input or inputs according to the current bin estimate
  
          Parameters
          ----------
          x       :   array or numeric
                      a value or array of values to fit within the estimated
                      bins
  
          Returns
          -------
          a bin index or array of bin indices that classify the input into one of
          the classifiers' bins.
  
          Note that this differs from similar functionality in
          numpy.digitize(x, classi.bins, right=True).
  
          This will always provide the closest bin, so data "outside" the classifier,
          above and below the max/min breaks, will be classified into the nearest bin.
  
          numpy.digitize returns k+1 for data greater than the greatest bin, but retains 0
          for data below the lowest bin.
          """; 13, assignment; 14, assignment; 15, comparison_operator:right.max() == len(self.bins); 16, block; 17, identifier:right; 18, identifier:x; 19, call; 20, identifier:right; 21, call; 22, call; 23, call; 24, expression_statement; 25, attribute; 26, argument_list; 27, attribute; 28, argument_list; 29, attribute; 30, argument_list; 31, identifier:len; 32, argument_list; 33, assignment; 34, call; 35, identifier:flatten; 36, identifier:np; 37, identifier:digitize; 38, identifier:x; 39, attribute; 40, keyword_argument; 41, identifier:right; 42, identifier:max; 43, attribute; 44, subscript; 45, binary_operator:len(self.bins) - 1; 46, attribute; 47, argument_list; 48, identifier:self; 49, identifier:bins; 50, identifier:right; 51, True; 52, identifier:self; 53, identifier:bins; 54, identifier:right; 55, comparison_operator:right == len(self.bins); 56, call; 57, integer:1; 58, identifier:np; 59, identifier:asarray; 60, identifier:x; 61, identifier:right; 62, call; 63, identifier:len; 64, argument_list; 65, identifier:len; 66, argument_list; 67, attribute; 68, attribute; 69, identifier:self; 70, identifier:bins; 71, identifier:self; 72, identifier:bins
code: def find_bin(self, x):
          """
          Sort input or inputs according to the current bin estimate
  
          Parameters
          ----------
          x       :   array or numeric
                      a value or array of values to fit within the estimated
                      bins
  
          Returns
          -------
          a bin index or array of bin indices that classify the input into one of
          the classifiers' bins.
  
          Note that this differs from similar functionality in
          numpy.digitize(x, classi.bins, right=True).
  
          This will always provide the closest bin, so data "outside" the classifier,
          above and below the max/min breaks, will be classified into the nearest bin.
  
          numpy.digitize returns k+1 for data greater than the greatest bin, but retains 0
          for data below the lowest bin.
          """
          x = np.asarray(x).flatten()
          right = np.digitize(x, self.bins, right=True)
          if right.max() == len(self.bins):
              right[right == len(self.bins)] = len(self.bins) - 1
          return right