MCPcopy Create free account
hub / github.com/numpy/numpy / ptp

Method ptp

numpy/matrixlib/defmatrix.py:760–791  ·  view source on GitHub ↗

Peak-to-peak (maximum - minimum) value along the given axis. Refer to `numpy.ptp` for full documentation. See Also -------- numpy.ptp Notes ----- Same as `ndarray.ptp`, except, where that would return an `ndarray` object, th

(self, axis=None, out=None)

Source from the content-addressed store, hash-verified

758 return N.ndarray.argmin(self, axis, out)._align(axis)
759
760 def ptp(self, axis=None, out=None):
761 """
762 Peak-to-peak (maximum - minimum) value along the given axis.
763
764 Refer to `numpy.ptp` for full documentation.
765
766 See Also
767 --------
768 numpy.ptp
769
770 Notes
771 -----
772 Same as `ndarray.ptp`, except, where that would return an `ndarray` object,
773 this returns a `matrix` object.
774
775 Examples
776 --------
777 >>> x = np.matrix(np.arange(12).reshape((3,4))); x
778 matrix([[ 0, 1, 2, 3],
779 [ 4, 5, 6, 7],
780 [ 8, 9, 10, 11]])
781 >>> x.ptp()
782 11
783 >>> x.ptp(0)
784 matrix([[8, 8, 8, 8]])
785 >>> x.ptp(1)
786 matrix([[3],
787 [3],
788 [3]])
789
790 """
791 return N.ndarray.ptp(self, axis, out)._align(axis)
792
793 @property
794 def I(self):

Callers 1

test_ptpMethod · 0.45

Calls 1

_alignMethod · 0.80

Tested by 1

test_ptpMethod · 0.36