I have the next list
lst = [([0, 0, 1, 1], [0, 1, 0, 1], [0, 2, 1, 2], [1, 1, 0, 0]), ([0, 0, 1, 1], [0, 2, 1, 2], [0, 1, 0, 1], [1, 1, 0, 0])]
each set has 4 lists that contain 4 integers inside.
I need a matrix in numpy like this one, (for the first set, for example):
numpy_matrix = [ [0, 0, 1, 1] , [0, 1, 0, 1]
[0, 2, 1, 2] , [1, 1, 0, 0] ]
notice that is a 2x2 matrix, and inside instead of saving integers is saving a list of those integers so I can do something like this:
print(numpy_array[0, 0][3]) # output: 1
I've tried this but didn't work:
np.matrix(lst[0]).reshape(2,-1)
# output:
# matrix([[0, 0, 1, 1, 0, 1, 0, 1],
# [0, 2, 1, 2, 1, 1, 0, 0]])
arr = np.array(lst[0]).reshape(2, 2, 4)?4is nedeed there? Please, post it as an answer so I can give your reply as correct! thanks :)np.array(lst).shape. It's (2,4,4), right? What shape do you want? Your focus onlst[0]makes things a bit unclear, but I think you want (2,2,2,4)