numpy中的ndarray与array的区别、不同

翻译自stackoverflow上的回答
https://stackoverflow.com/questions/15879315/what-is-the-difference-between-ndarray-and-array-in-numpy

问:What is the difference between ndarray and array in Numpy? And where can I find the implementations in the numpy source code?
(Numpy中ndarray和array的区别是什么?我在哪儿能够找到numpy中相应的实现?)

答:Well, np.array is just a convenience function to create an ndarray, it is not a class itself.
(嗯,np.array只是一个便捷的函数,用来创建一个ndarray,它本身不是一个类)

You can also create an array using np.ndarray, but it is not the recommended way. From the docstring of np.ndarray:
(你也能够用np.ndarray来创建,但这不是推荐的方式。来自np.ndarray的文档:)

Arrays should be constructed using array, zeros or empty … The parameters given here refer to a low-level method (ndarray(…)) for instantiating an array.
(Arrays 应该能用array,zeros 或empty来构造…这里的参数和一个实例化array的低层方法与有关)

Most of the meat of the implementation is in C code, here in multiarray, but you can start looking at the ndarray interfaces here:
https://github.com/numpy/numpy/blob/master/numpy/core/numeric.py

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值