是什么在numpy的ndarray和阵列之间的区别? [英] What is the difference between ndarray and array in numpy?

查看:168
本文介绍了是什么在numpy的ndarray和阵列之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是在numpy的ndarray和阵列之间的区别?和我在哪里可以找到实现在numpy的源$ C ​​$ C?

what is the difference between ndarray and array in numpy? And where can I find the implementations in the numpy source code?

谢谢!

编辑:这是关于numpy.ndarray和numpy.array,不是名单。问题是没有一个重复的建议。

This is about numpy.ndarray and numpy.array, not about list. The question is not a duplicate of the one suggested.

推荐答案

好了, np.array 只是一个方便的功能,创建一个 ndarray ,它不是一个类本身。

Well, np.array is just a convenience function to create an ndarray, it is not a class itself.

您也可以创建一个使用 np.ndarray 一个数组,但它是不推荐的方式。从文档字符串 np.ndarray

You can also create an array using np.ndarray, but it is not the recommended way. From the docstring of np.ndarray:

阵列应使用阵列零构造 ...这里给出的参数指
  低级别的方法( 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.

大多数实施肉是C code,在这里多阵列,但你可以开始寻找在这里ndarray接口:

Most of the meat of the implementation is in C code, here in multiarray, but you can start looking at the ndarray interfaces here:

<一个href=\"https://github.com/numpy/numpy/blob/master/numpy/core/numeric.py\">https://github.com/numpy/numpy/blob/master/numpy/core/numeric.py

这篇关于是什么在numpy的ndarray和阵列之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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