Issue
I am trying to append two numpy arrays A
and J[0]
using np.concatenate
but there is an error. I also present the expected output.
import numpy as np
A=np.array([ 1, 3, 5, 7, 9, 10, 12, 13, 14, 15, 16, 18, 20, 21, 22, 23])
J=[[4, 6, 8, 11, 17, 19]]
J=np.array(J)
T=np.concatenate(A,J[0],axis=1)
The error is
in <module>
T=np.concatenate(A,J[0],axis=1)
File "<__array_function__ internals>", line 4, in concatenate
TypeError: concatenate() got multiple values for argument 'axis'
The expected output is
array([ 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23])
Solution
T = np.sort(np.concatenate((A, J[0])))
Answered By - Tom McLean
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.