Let's say I have an array:
A = [20, 18, 25, 33, 32, 22, 14, 20, 24, 33, 66, 70, 60, 50]
How do I get an array B
that is the first minus the second, the second minus the third so on to get this:
B = [2, -7, -8, 1, 10, 8, -6, -4, -9, -33, -4, 10, 10]
and then plot B
?
Thank you for your help!
I have tried to do:
B = ([(n+1)-n] for n in zip(A))
but when I try to plot the graph it gives back the error:
matplotlib does not support generators as input
Also to explain better the array is much longer and in decimals, this is just an approximation of what the actual problem is, thank you!