code: def block(x, y, new_x):
      """
      Essentially a step function.
  
      For each `new_x`, finds largest j such that``x[j] < new_x[j]`` and
      returns ``y[j]``.
  
      Parameters
      ----------
      x : array_like
          Independent values.
      y : array_like
          Dependent values.
      new_x : array_like
          The x values used to calculate the interpolated y.
  
      Returns
      -------
      block : ndarray
          Return array, of same length as `x_new`.
  
      """
      # find index of values in x that precede values in x
      # This code is a little strange -- we really want a routine that
      # returns the index of values where x[j] < x[index]
      TINY = 1e-10
      indices = np.searchsorted(x, new_x + TINY) - 1
  
      # If the value is at the front of the list, it'll have -1.
      # In this case, we will use the first (0), element in the array.
      # take requires the index array to be an Int
      indices = np.atleast_1d(np.clip(indices, 0, np.Inf).astype(int))
      new_y = np.take(y, indices, axis=-1)
      return new_y
  
file_path: catboost/contrib/python/scipy/py2/scipy/interpolate/interpolate_wrapper.py
imports: from __future__ import division, print_function, absolute_import
  import numpy
  from .None import _interpolate
label_desc: Use image node_id 6 for calling a global function with example usage: block(x, y, new_x) and returns: new_y