NumPyflat函数

首页 / Numpy入门教程 / NumPyflat函数

此函数在数组上返回一维迭代器,它的行为类似于Python的内置迭代器。

import numpy as np 
a=np.arange(8).reshape(2,4) 
print 'The original array:' 
print a 
print '\n' 

print 'After applying the flat function:' 
# returns element corresponding to index in flattened array 
print a.flat[5]

其输出如下-

无涯教程网

链接:https://www.learnfk.comhttps://www.learnfk.com/numpy/numpy-ndarray-flat.html

来源:LearnFk无涯教程网

The original array:
[[0 1 2 3]
 [4 5 6 7]]

After applying the flat function:
5

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

教程推荐

Vue 3 企业级项目实战课 -〔杨文坚〕

超级访谈:对话毕玄 -〔毕玄〕

如何讲好一堂课 -〔薛雨〕

如何落地业务建模 -〔徐昊〕

恋爱必修课 -〔李一帆〕

成为AI产品经理 -〔刘海丰〕

用户体验设计实战课 -〔相辉〕

人人都能学会的编程入门课 -〔胡光〕

机器学习40讲 -〔王天一〕

好记忆不如烂笔头。留下您的足迹吧 :)