[Tutor] Python 3 Combine 1 D Arrays
__peter__ at web.de
Thu May 18 03:07:22 EDT 2017
Stephen P. Molnar wrote:
> I'm beginning to think that I don't know how to ask the question as
> Google and Stack Overflow have resulted in nothing. All of the results
> seem to deal with integers.
> I have a number of single column floating point arrays each containing
> 300 entries that I want to combine into a n by 300 array where n is the
> number of single column arrays.
> I have tried zip, np.concatenate etc with only failure.
> Thanks in advance.
numpy combine 1d arrays into 2d array
as the first hit. Does that help? The second hit
should also work, and the best approach is probably #3:
>>> import numpy as np
>>> a = np.array([1.2, 3.4, 5.6])
>>> b = np.array([10.11, 12.13, 14.15])
>>> np.column_stack((a, b))
array([[ 1.2 , 10.11],
[ 3.4 , 12.13],
[ 5.6 , 14.15]])
No rocket science ;)
More information about the Tutor