为什么"无"有AS&QUOT相同的效果; np.newaxis"? [英] Why "None" has the same effect as "np.newaxis"?

查看:153
本文介绍了为什么"无"有AS&QUOT相同的效果; np.newaxis"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 np.newaxis 的保存效果?例如,使用

Why None has the save effect of np.newaxis? For example, using:

np.arange(10)[:,None]

np.arange(10)[:,np.newaxis]

这两个创建:

array([[0],
       [1],
       [2],
       [3],
       [4],
       [5],
       [6],
       [7],
       [8],
       [9]])

有谁知道原因 np.newaxis ==无

推荐答案

那是因为<一href=\"http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#numpy.newaxis\"><$c$c>numpy.newaxis,因为它在文档中说,一个别名: ,也可以用来代替<$的C $ C> newaxis 。

Thats because numpy.newaxis is an alias for None as it says in the documentation: None can also be used instead of newaxis.

这篇关于为什么&QUOT;无&QUOT;有AS&QUOT相同的效果; np.newaxis&QUOT;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆