Message291967
The few following lines, i believe, show how the numpy.ndarray.T or numpy.ndarray.transpose() don't change the structure of the data only the way they're displayed. Which is sometimes a problem when handling big quantities of data which you need to look at a certain way for sorting problems among others.
>>> import numpy as np
>>> x=np.array([[0,1,2],[1,2,3]])
>>> x=x.T
>>> print x
[[0 1]
[1 2]
[2 3]]
>>> y=np.array([[0,1],[1,2],[2,3]])
>>> print y
[[0 1]
[1 2]
[2 3]]
>>> y.view('i8,i8')
array([[(0, 1)],
[(1, 2)],
[(2, 3)]],
dtype=[('f0', '<i8'), ('f1', '<i8')])
>>> x.view('i8,i8')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: new type not compatible with array. |
|
Date |
User |
Action |
Args |
2017-04-20 12:08:52 | m.meliani | set | recipients:
+ m.meliani |
2017-04-20 12:08:52 | m.meliani | set | messageid: <1492690132.67.0.227049528037.issue30116@psf.upfronthosting.co.za> |
2017-04-20 12:08:52 | m.meliani | link | issue30116 messages |
2017-04-20 12:08:52 | m.meliani | create | |
|