Home > Software design >  How do I create One array from a sequence of arrays in Python using numpy
How do I create One array from a sequence of arrays in Python using numpy

Time:01-25

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.

CodePudding user response:

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

  • Related