IdanSi
IdanSi

Reputation: 18

How do I create One array from a sequence of arrays in Python using numpy

I'm trying to create one array which is a sequence of the following numpy arrays: np.random.normal([0, 0], size=(500, 2)), np.random.normal([5, 5], size=(500, 2)), np.random.normal([5, 0], size=(500, 2)), np.random.normal([0, 5], size=(500, 2)) How can I merge them into one? Tnx!

I tried using + operator but didn't work.

Upvotes: 0

Views: 73

Answers (1)

Ishtiyak
Ishtiyak

Reputation: 91

You can use the numpy concatenate() method to combine multiple arrays into one.

The syntax would be:

np.concatenate([np.random.normal([0, 0], size=(500, 2)), np.random.normal([5, 5], size=(500, 2)), np.random.normal([5, 0], size=(500, 2)), np.random.normal([0, 5], size=(500, 2))])

Hope this will solve your issue

Upvotes: 1

Related Questions