#一维数组转化成二维的方法: np.random.seed(101) arr=np.random.randint(1,4,size=6) print("\n原数组:\n",arr) print("\n如何把一维数组转换成二维的:") print("arr[:,None]:\n",arr[:,None]) print("") print("arr[:,np.newaxis]:\n",arr[:,np.newaxis])
以下是官方文档对None的说明:
另一个网址:
https://numpy.org/devdocs/reference/arrays.indexing.html
numpy.newaxis A convenient alias(别名) for None, useful for indexing arrays.
原文地址:https://www.cnblogs.com/bravesunforever/p/12668908.html
时间: 2024-10-29 02:47:54