Is there a function that returns an array with the results of dividing the next element by the previous one? Like a "diff()", but with dividing
Not-numpy-example:
t=[1,3,6,24,36]
t1 = [j / i for i, j in zip(t[:-1], t[1:])]
Is there a function that returns an array with the results of dividing the next element by the previous one? Like a "diff()", but with dividing
Not-numpy-example:
t=[1,3,6,24,36]
t1 = [j / i for i, j in zip(t[:-1], t[1:])]
Assign t
to a numpy array:
t = np.array(t)
Simply divide:
>>> t[1:] / t[:-1]
array([3. , 2. , 4. , 1.5])