A = np.array([[4.0, 3, 2],
[1, 2, 3],
[0, -1, 5]])
shift = np.array([1,2,1])
out = np.array([[3, 2, np.nan],
[3, np.nan, np.nan],
[-1, 5, np.nan]])
I want to left shift the 2D numpy array towards the left for each row independently as given by the shift vector and impute the right with Nan.
Please help me out with this
Thanks