-2

My issue is this. I have an array like this :

test = array([[1],[2],[10] .... [-5]])

I want to be able to just convert this to an array that looks like this

test = [1,2,10,..., -5]

The test is a numpy array.

0

1 Answer 1

0

You can use reshape() to change the array into 1D array as:

import numpy as np
test = np.array([[1],[2],[10],[-5]])
test=test.reshape((test.shape[0],))  # test.shape[0] gives the first dimension (the number of rows)
# reshape changes test array to one dimensional array with shape (test.shape[0],) 
print(test)
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.