Re: [Tutor] Pyuthon 3 Combine 1 D Arrays

2017-05-18 Thread Stephen P. Molnar

On 05/17/2017 06:15 PM, Luis JM Amoreira wrote:

Hi,
If your arrays have shape (300,1) (single column, 300 rows right?) then
M = numpy.hstack((array1, array2)) is an array with shape (300, 2) (300
rows, 2 columns) and M.T is 2 by 300 [shape (2, 300)]. Take an example:

In [11]: import numpy as np

In [12]: a1=np.random.rand(3,1)

In [13]: a1
Out[13]:
array([[ 0.09042866],
[ 0.63008665],
[ 0.99106757]])

In [14]: a2=np.random.rand(3,1)

In [15]: np.hstack((a1,a2))
Out[15]:
array([[ 0.09042866,  0.99965848],
[ 0.63008665,  0.12334957],
[ 0.99106757,  0.43502637]])

In [16]: np.hstack((a1,a2)).T
Out[16]:
array([[ 0.09042866,  0.63008665,  0.99106757],
[ 0.99965848,  0.12334957,  0.43502637]])

Hope this helps!
ze


On 05/17/2017 08:50 PM, 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.



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor




Thanks for your reply.

Here's what I get:

Traceback (most recent call last):

  File "", line 1, in 

runfile('/home/comp/Apps/Python/Molecular_Transforms/Basic/MolT_app_1.py', 
wdir='/home/comp/Apps/Python/Molecular_Transforms/Basic')


  File 
"/home/comp/Apps/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", 
line 880, in runfile

execfile(filename, namespace)

  File 
"/home/comp/Apps/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", 
line 102, in execfile

exec(compile(f.read(), filename, 'exec'), namespace)

  File 
"/home/comp/Apps/Python/Molecular_Transforms/Basic/MolT_app_1.py", line 
289, in 

f.write("\n".join("".join(map(str, x)) for x in (name_I_app)))

  File 
"/home/comp/Apps/Python/Molecular_Transforms/Basic/MolT_app_1.py", line 
289, in 

f.write("\n".join("".join(map(str, x)) for x in (name_I_app)))

TypeError: 'numpy.float64' object is not iterable

However, numpy.column_stack works.

Problem solved.

--
Stephen P. Molnar, Ph.D.Life is a fuzzy set
www.molecular-modeling.net  Stochastic and multivariate
(614)312-7528 (c)
Skype: smolnar1
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Pyuthon 3 Combine 1 D Arrays

2017-05-17 Thread Alan Gauld via Tutor
On 17/05/17 20:50, 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.

Have you tried asking on the scipy forum?

https://www.scipy.org/scipylib/mailing-lists.html

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Pyuthon 3 Combine 1 D Arrays

2017-05-17 Thread Stephen P. Molnar
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.

--
Stephen P. Molnar, Ph.D.Life is a fuzzy set
www.molecular-modeling.net  Stochastic and multivariate
(614)312-7528 (c)
Skype: smolnar1
1.00e+00
1.100334448160535050e+00
1.200668896321070322e+00
1.301003344481605373e+00
1.401337792642140423e+00
1.501672240802675695e+00
1.602006688963210745e+00
1.702341137123745796e+00
1.802675585284280846e+00
1.903010033444816118e+00
2.003344481605351390e+00
2.103678929765885997e+00
2.204013377926421491e+00
2.304347826086956541e+00
2.404682274247491591e+00
2.505016722408027086e+00
2.605351170568561692e+00
2.705685618729097186e+00
2.806020066889632236e+00
2.906354515050167286e+00
3.006688963210702337e+00
3.107023411371237387e+00
3.207357859531772437e+00
3.307692307692307931e+00
3.408026755852842982e+00
3.508361204013378032e+00
3.608695652173913082e+00
3.709030100334448132e+00
3.809364548494983183e+00
3.909698996655518677e+00
4.010033444816054171e+00
4.110367892976588777e+00
4.210702341137123383e+00
4.311036789297658878e+00
4.411371237458194372e+00
4.511705685618728978e+00
4.612040133779264472e+00
4.712374581939799967e+00
4.812709030100334573e+00
4.913043478260869179e+00
5.013377926421404673e+00
5.113712374581940168e+00
5.214046822742474774e+00
5.314381270903010268e+00
5.414715719063544874e+00
5.515050167224080369e+00
5.615384615384615863e+00
5.715719063545150469e+00
5.816053511705685963e+00
5.916387959866220569e+00
6.016722408026756064e+00
6.117056856187290670e+00
6.217391304347826164e+00
6.317725752508361658e+00
6.418060200668896265e+00
6.518394648829431759e+00
6.618729096989966365e+00
6.719063545150501859e+00
6.819397993311037354e+00
6.919732441471571960e+00
7.020066889632107454e+00
7.120401337792642060e+00
7.220735785953177555e+00
7.321070234113712161e+00
7.421404682274247655e+00
7.521739130434783149e+00
7.622073578595317755e+00
7.722408026755853250e+00
7.822742474916387856e+00
7.923076923076923350e+00
8.023411371237457956e+00
8.123745819397992562e+00
8.224080267558528945e+00
8.324414715719063551e+00
8.424749163879599934e+00
8.525083612040134540e+00
8.625418060200669146e+00
8.725752508361203752e+00
8.826086956521738358e+00
8.926421404682274741e+00
9.026755852842809347e+00
9.127090301003343953e+00
9.227424749163880335e+00
9.327759197324414941e+00
9.428093645484949548e+00
9.528428093645485930e+00
9.628762541806020536e+00
9.729096989966555142e+00
9.829431438127089748e+00
9.929765886287626131e+00
1.003010033444816074e+01
1.013043478260869534e+01
1.023076923076923173e+01
1.033110367892976633e+01
1.043143812709030094e+01
1.053177257525083554e+01
1.063210702341137193e+01
1.073244147157190653e+01
1.083277591973244114e+01
1.093311036789297752e+01
1.103344481605351213e+01
1.113377926421404673e+01
1.123411371237458134e+01
1.133444816053511772e+01
1.143478260869565233e+01
1.153511705685618693e+01
1.163545150501672332e+01
1.173578595317725792e+01
1.183612040133779253e+01
1.193645484949832891e+01
1.203678929765886352e+01
1.213712374581939812e+01
1.223745819397993273e+01
1.233779264214046911e+01
1.243812709030100372e+01
1.253846153846153832e+01
1.263879598662207471e+01
1.273913043478260931e+01
1.283946488294314392e+01
1.293979933110367853e+01
1.304013377926421491e+01
1.314046822742474951e+01
1.324080267558528412e+01
1.334113712374582050e+01
1.344147157190635511e+01
1.354180602006688972e+01
1.364214046822742432e+01
1.374247491638796070e+01
1.384280936454849531e+01
1.394314381270902992e+01
1.404347826086956630e+01
1.414381270903010090e+01
1.424414715719063551e+01
1.434448160535117012e+01
1.81605351170650e+01
1.454515050167224111e+01
1.464548494983277571e+01
1.474581939799331209e+01
1.484615384615384670e+01
1.494648829431438131e+01
1.504682274247491591e+01
1.514715719063545230e+01
1.524749163879598690e+01
1.534782608695652151e+01
1.544816053511705789e+01
1.554849498327759250e+01
1.564882943143812710e+01
1.574916387959866171e+01
1.584949832775919809e+01
1.594983277591973270e+01
1.605016722408026908e+01
1.615050167224080369e+01
1.625083612040133829e+01
1.635117056856187290e+01
1.645150501672240750e+01
1.655183946488294566e+01
1.665217391304347672e+01
1.675250836120401488e+01
1.685284280936454948e+01
1.695317725752508409e+01
1.705351170568561869e+01
1.715384615384615330e+01
1.725418060200668791e+01
1.735451505016722606e+01
1.745484949832776067e+01
1.755518394648829528e+01
1.765551839464882988e+01
1.775585284280936449e+01
1.785618729096989910e+01
1.795652173913043370e+01
1.805685618729097186e+01
1.815719063545150647e+01
1.825752508361204107e+01
1.835785953177257568e+01
1.845819397993311028e+01
1.855852842809364489e+01