最佳答案
numpy.Array
只是创建 ndarray
的便利功能;它本身不是一个类。
您还可以使用 numpy.ndarray
创建一个数组,但这不是建议的方式。来自 numpy.ndarray
的文档字符串:
Arrays should be constructed using
array
,zeros
orempty
... The parameters given here refer to a low-level method (ndarray(...)
) for instantiating an array.
实现的大部分内容都在 C 代码中,here in multiarray ,但您可以从这里开始查看 ndarray 接口(interface):
https://github.com/numpy/numpy/blob/master/numpy/core/numeric.py
关于python - NumPy 中的 ndarray 和数组有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15879315/