调整数组维度 resize
用法
resize(numpy.ndarray, axes=[])
axes: 必须参数,修改维度,给出每个维度的长度
实例:IPython 交互
>>> import numpy as np
>>> a = np.arange(16).reshape(2, 8)
>>> a
array([[ 0, 1, 2, 3, 4, 5, 6, 7],
[ 8, 9, 10, 11, 12, 13, 14, 15]])
>>> np.resize(a, [4,4])
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[12, 13, 14, 15]])
>>> np.resize(a, [2,2,4])
array([[[ 0, 1, 2, 3],
[ 4, 5, 6, 7]],
[[ 8, 9, 10, 11],
[12, 13, 14, 15]]])
标签:11,np,维度,array,numpy,resize
From: https://www.cnblogs.com/52note/p/16704069.html