Concatenating two one-dimensional NumPy arrays

0 votes

How do I concatenate two one-dimensional arrays in NumPy? I tried numpy.concatenate:

import numpy as np
a = np.array([1, 2, 3])
b = np.array([4, 5])
np.concatenate(a, b)

But I get an error

Nov 16, 2022 in Python by Ashwini
• 5,430 points
424 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

mapping two numpy arrays

Here's a NumPythonic vectorized approach - B[:,1][(A == ...READ MORE

answered May 10, 2019 in Python by SDeb
• 13,300 points
2,640 views
0 votes
0 answers

Concatenate two numpy arrays in the 4th dimension

I got two numpy arrays in three ...READ MORE

Aug 1, 2022 in Python by krishna
• 2,820 points
300 views
0 votes
0 answers

What are the differences between numpy arrays and matrices? Which one should I use?

What are each's advantages and drawbacks? I've noticed ...READ MORE

Aug 8, 2022 in Python by krishna
• 2,820 points
436 views
0 votes
1 answer

Numpy: Multiplying large arrays with dtype=int8 is SLOW

Unfortunately, the "engine" behind the scenes is BLAS, ...READ MORE

answered May 9, 2018 in Python by charlie_brown
• 7,720 points
1,049 views
0 votes
1 answer

Combining numpy arrays

There is concatenation function for numpy arrays ...READ MORE

answered Jul 3, 2018 in Python by Hamartia's Mask
• 1,580 points
934 views
0 votes
1 answer

Save NumPy arrays to File

Try this: np.savetxt('file.txt',arr,delimiter=' ') will save to a text ...READ MORE

answered May 24, 2019 in Python by Jason
1,176 views
0 votes
1 answer

Numpy: Multiplying large arrays with dtype=int8 is SLOW

Unfortunately, as correctly underlined in the comments, the ...READ MORE

answered Sep 5, 2018 in Python by Priyaj
• 58,090 points
2,619 views
0 votes
1 answer

Python Pandas: selecting element in array column

pa.loc[row] selects the row with label row. pa.loc[row, ...READ MORE

answered May 13, 2019 in Python by SDeb
• 13,300 points
12,631 views
0 votes
1 answer

NumPy Array Indexing

If you want to create a subarray ...READ MORE

answered Jul 26, 2019 in Python by SDeb
• 13,300 points
518 views
0 votes
1 answer

ValueError: setting an array element with a sequence

The problem is the shape of the ...READ MORE

answered May 1, 2022 in Python by narikkadan
• 63,620 points
1,979 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP