python: numpy的ndarray和array有什么区别?为什么不能plt.imshow()一个ndarray矩阵?
展开全部
问: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的低层方法与有关)
(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的低层方法与有关)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询