'New array with subtracted elements using Python

I want to create a new array which basically consists of elements obtained after subtracting the adjacent elements of I.

import numpy as np
I=np.array([0.42741221, 0.32863457, 0.03597327, 0.23270579, 0.24660262,
       0.28189469, 0.30789726, 0.26947605, 0.11872097, 0.0089662 ,
       0.3677314 , 0.00606158, 0.2923718])

Desired output:

np.array([(0.42741221-0.32863457), (0.32863457-0.03597327), (0.03597327-0.23270579),...])


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source