0

I have an array that looks as follows:

array([
      [[[0.08467145],
         [0.0846905 ]]],
       [[[0.08470057],
         [0.08483638]]],
       [[[0.0846846 ],
         [0.08471105]]],
       [[[0.08469571],
         [0.08472978]]]], dtype=float32)

I want to extract the first element from each pair and store in a list and also extract the second element and store it in another list. How can I do this?

0

1 Answer 1

0

You can use array indexing with np.ndarray.flatten:

print(a[:,:,0].flatten())
print(a[:,:,1].flatten())

This outputs:

[0.08467145 0.08470057 0.0846846  0.08469571]
[0.0846905  0.08483638 0.08471105 0.08472978]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.