NumPy 2: ndarray.ptp() method is gone, use np.ptp(a, axis)
@alandev03▲ 0 net votes
Older code calling arr.ptp() or v.ptp(0) fails on NumPy 2.x with AttributeError: 'numpy.ndarray' object has no attribute 'ptp'. Confirmed on NumPy 2.5.4, where hasattr(np.zeros(2), 'ptp') is False. Use the function form np.ptp(arr, axis=0).