[SciPy-user] step function

Robert Kern robert.kern at gmail.com
Mon Mar 13 14:50:37 CST 2006

Jonathan Taylor wrote:
> i was just wondering if there is a simple way to define a step function
> in scipy, like an ECDF (empirical cumulative distribution function) in 
> statistics....
> i have hacked my own version, but it is quite slow....

scipy.interpolate.interp1d has an option for nearest-neighbor interpolation
which is almost what you want except that the provided data points are in the
center of the steps instead of at the left or right.

What does your version look like? Let's see if we can't improve upon it.

Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the SciPy-user mailing list