Given a 1-D float array of monthly revenue in chronological order, return an array of the same length:
np.nan
i
(x[i] - x[i-1]) / x[i-1]
Input
[100. 110. 99. 0. 50.]
Output
[ nan 0.1 -0.1 -1. nan]
This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.
solve(...)