0

lets say I have an array of the form

Y=
 array([[[6.45285536, 4.13302386]],

   [[7.6683039 , 7.66590237]],

   [[6.65061296, 5.79469154]],

   ...,

   [[7.43964513, 4.18676161]],

   [[4.95229954, 7.41067346]],

   [[4.02962837, 6.64919938]]]

and the shape looks like

Y.shape
   (1000, 1, 2)

how can I convert/reshape this such that it has

(1000,2)

?

Thank you in advance!

2

1 Answer 1

2

You should reshape your numpy array as Y.reshape(-1,2)

Sign up to request clarification or add additional context in comments.

3 Comments

thank you, this worked well! is there an easy way to add a new column to a given array? I mean like going from (100,2) ---> (100,3)?
thanks. I would appreciate if you can create a new question so that others can benefits also.
I can post a question once per 90min.. I will post it as soon as possible

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.