1

I have a numpy array label as

 l = []
    for i in range(3):
        l.append(np.arange(3))
    label = np.array(l, dtype = np.object)
    print(label)
    print(label.shape)
    print(label[0].shape)

[[0 1 2]
[0 1 2]
[0 1 2]]
(3, 3)
(3,)

I want to convert label to a 1-D array of arrays such that label.shape gives me (3, ) and label[0].shape also gives me (3,)

Basically I want label as array(array(0,1,2), array(0,1,2), array(0,1,2))

user3828311
  • 907
  • 4
  • 11
  • 20

0 Answers0