There is the diff
method:
a = range(5) # python list of numpy array
np.diff(a)
returns
array([1, 1, 1, 1])
More Related Contents:
- What are the advantages of NumPy over regular Python lists?
- What is the difference between contiguous and non-contiguous arrays?
- Translate every element in numpy array according to key
- Automatically import modules when entering the python or ipython interpreter
- Plotting a fast Fourier transform in Python
- Equivalent of Numpy.argsort() in basic python? [duplicate]
- How to create a density plot in matplotlib?
- How to do n-D distance and nearest neighbor calculations on numpy arrays
- How can I check whether a numpy array is empty or not?
- Numpy Resize/Rescale Image
- How to use numpy.genfromtxt when first column is string and the remaining columns are numbers?
- faster alternative to numpy.where?
- why does pandas rolling use single dimension ndarray
- The truth value of an array with more than one element is ambigous when trying to index an array
- Storing numpy sparse matrix in HDF5 (PyTables)
- Numpy loading csv TOO slow compared to Matlab
- How to calculate the statistics “t-test” with numpy
- Performance of zeros function in Numpy
- Creating a Confidence Ellipsis in a scatterplot using matplotlib
- Circular shift of vector (equivalent to numpy.roll)
- Numpy array dimensions
- Numpy slice of arbitrary dimensions
- What are the available datatypes for ‘dtype’ with NumPy’s loadtxt() an genfromtxt?
- How to find linearly independent rows from a matrix
- Access n-th dimension in python [duplicate]
- How does the axis parameter from NumPy work?
- Large Performance difference when summing ints vs floats in Cython vs NumPy
- Shift rows of a numpy array independently
- Formatting floats in a numpy array [duplicate]
- Add density curve on the histogram