numpy中改变数组形状大小
属性:
size:Number ofelements in the array
shape:Tuple ofarray dimensions
成员方法:
reshape:Gives a newshape to an array without changing its data
即改变前后数据元素数量不变
resize:Return a newarray with the specified shape
即改变前后数据元素数量可变
numpy中如何将多维数组变成一维数组
方法1:
![](https://i-blog.csdnimg.cn/blog_migrate/eddd1d8d0ebf518db56e1e55ae8e48ed.png)
ndarray也有ravel()成员函数。
方法2:
![](https://i-blog.csdnimg.cn/blog_migrate/c444aeb19624aaded745f7ea89038e27.png)