I am having the following array
import numpy as np
T = np.array(([1,-1,0,0,0,0],
[3,0,5,0,0,0],
[0,-1,0,9,0,0],
[0,0,0,0,-2,1],
[3,1,0,0,2,0],
[1,-2,1,0,2,2]))
I want to remove the first column and the last row of the array. So I should get:
T = [[-1 0 0 0 0],
[0 5 0 0 0],
[-1 0 9 0 0],
[0 0 0 -2 1],
[1 0 0 2 0]]
I wrote following line of code:
T = T[:len(T)-1][1:len(T[0])]
But I don't get the result I am expecting. The result I get is this:
[[ 3 0 5 0 0 0]
[ 0 -1 0 9 0 0]
[ 0 0 0 0 -2 1]
[ 3 1 0 0 2 0]]
Can anyone tell me what I am doing wrong and also the correct way to slice the array?