用python做数据分析(行列转换)

python行列转换
用reshape是有问题的,因为这是根据一个顺序的数进行遍历的
但是,用下面这个函数就有了对应的操作

C:\Users\Administrator>python
Python 3.5.4 (v3.5.4:3f56838, Aug  8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)]
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a = [[1,2],[3,4]]
>>> print(a)
[[1, 2], [3, 4]]
>>> print(list(map(list, zip(*a))))
[[1, 3], [2, 4]]
>>>

你可能感兴趣的:(python,安装,Python)