0

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])
1
  • reread the np.concatenate docs! Commented Sep 6, 2022 at 14:47

1 Answer 1

1
T = np.sort(np.concatenate((A, J[0])))
Sign up to request clarification or add additional context in comments.

Comments

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.