Assume to have the below numpy array:
import numpy as np
array_a = np.arange(1,10).reshape(3,3)
array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
How can I iteratively multiply the previous row with the subsequent row without using any loop (the value of the previous row, except row=0, being the product of the multiplication).
The desired output for the above array_a would be
[[1, 2, 3
[4, 10, 18]
[28, 80, 162]]
I am aware of numpy matrix multiplication function like np.dot and np.einsum but I am not able to frame my problem in a way to use those functions. A solution in pandas, if any, is also welcome. Thank you for any guidance.