方法
matrix.
ptp
沿给定轴的峰间(最大-最小)值。
参照 numpy.ptp 完整文件。
numpy.ptp
参见
笔记
等同于 ndarray.ptp ,除了,在哪里可以返回 ndarray 对象,这将返回 matrix 对象。
ndarray.ptp
ndarray
matrix
实例
>>> x = np.matrix(np.arange(12).reshape((3,4))); x matrix([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]]) >>> x.ptp() 11 >>> x.ptp(0) matrix([[8, 8, 8, 8]]) >>> x.ptp(1) matrix([[3], [3], [3]])