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
627 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,993 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
466 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
614 views
0 votes
1 answer

Numpy: Multiplying large arrays with dtype=int8 is SLOW

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

answered May 9, 2018 in Python by charlie_brown
• 7,720 points
1,273 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
1,127 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,397 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,020 points
3,013 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
13,359 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
692 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,600 points
2,404 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