I have a function that takes 2 parameters and returns a shape of an array.
The output should be like this: array(\[\[A\], \[B\], \[B\]\])
, but I got it like this: array(\[\[A, B, C\]\])
.
What is the methoud that I can use to return it like this: array(\[\[A\], \[B\], \[B\]\])
For example, initialise_array(3,1)
will return an array of dimensions (3,1)
that can look like this:
array([[0.37454012], [0.95071431], [0.73199394]])
My code:
def initialise_array(n_features, n_observations):
shape = np.random.rand(n_features, n_observations)
n_shape = shape.reshape(n_observations, n_features)
return n_shape
The output looks like array([[0.85546058, 0.70365786, 0.47417383]])
but I need to match the this array([[0.37454012], [0.95071431], [0.73199394]])