I have an variable i_k from I[0]
i_k = I[0]
where
I:
[[0.2]
[0.3]
[0.4]
[0.5]
[0.6]]
So i_k should be 0.2.
Then when I am trying to create a numpy array
H_k = np.array([[i_k,1]])
instead having [[0.2 1.]], what I have is
[[array([0.2]) 1]]
I am confused. How do I get [[0.2 1.]]? Thanks.
CodePudding user response:
I is a 2D array, so when you say i_k = I[0] you get [0.2]. You can fix this by saying i_k = I[0][0] or i_k = I.flat[0].
