此函数返回折叠成一维的数组,该函数采用以下参数。
ndarray.flatten(order)
Sr.No. | 描述 |
---|---|
1 | order 链接:https://www.learnfk.comhttps://www.learnfk.com/numpy/numpy-ndarray-flatten.html 来源:LearnFk无涯教程网 'C'-行主(默认。'F':列'A':以列顺序进行展平,如果a在内存中是连续的Fortran,则为行主顺序,否则'K':按元素顺序进行展平发生在内存中 |
import numpy as np a = np.arange(8).reshape(2,4) print 'The original array is:' print a print '\n' # default is column-major print 'The flattened array is:' print a.flatten() print '\n' print 'The flattened array in F-style ordering:' print a.flatten(order = 'F')
上述程序的输出如下:
The original array is: [[0 1 2 3] [4 5 6 7]] The flattened array is: [0 1 2 3 4 5 6 7] The flattened array in F-style ordering: [0 4 1 5 2 6 3 7]
这一章《NumPy - 数组操作 - flatten函数》你学到了什么?在下面做个笔记吧!做站不易,你的分享是对我们最大的支持
我通过postman 获得状态代码 200,但通过 request.get 我获得状...
如何将postman 中的 JSON 格式数据发送到具有另一个模型的外键的...
Python pandas:来自 get_dummies 的动态连接