From 9038b1acc4adb0aa6c0a064847ad4a8a2df62a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Sok=C3=B3=C5=82?= Date: Sun, 17 Sep 2023 19:24:05 +0200 Subject: [PATCH] MAINT: Cleanup expired ndarray methods --- examples/applications/plot_stock_market.py | 8 ++++---- sklearn/tree/tests/test_tree.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/applications/plot_stock_market.py b/examples/applications/plot_stock_market.py index cdf5a36074923..30d9c441ffa57 100644 --- a/examples/applications/plot_stock_market.py +++ b/examples/applications/plot_stock_market.py @@ -263,12 +263,12 @@ ) plt.xlim( - embedding[0].min() - 0.15 * embedding[0].ptp(), - embedding[0].max() + 0.10 * embedding[0].ptp(), + embedding[0].min() - 0.15 * np.ptp(embedding[0]), + embedding[0].max() + 0.10 * np.ptp(embedding[0]), ) plt.ylim( - embedding[1].min() - 0.03 * embedding[1].ptp(), - embedding[1].max() + 0.03 * embedding[1].ptp(), + embedding[1].min() - 0.03 * np.ptp(embedding[1]), + embedding[1].max() + 0.03 * np.ptp(embedding[1]), ) plt.show() diff --git a/sklearn/tree/tests/test_tree.py b/sklearn/tree/tests/test_tree.py index 6d1719089cd39..2543a2f2a39ad 100644 --- a/sklearn/tree/tests/test_tree.py +++ b/sklearn/tree/tests/test_tree.py @@ -2083,7 +2083,7 @@ def test_different_endianness_pickle(): score = clf.score(X, y) def reduce_ndarray(arr): - return arr.byteswap().newbyteorder().__reduce__() + return arr.byteswap().view(arr.dtype.newbyteorder()).__reduce__() def get_pickle_non_native_endianness(): f = io.BytesIO() @@ -2110,7 +2110,7 @@ def test_different_endianness_joblib_pickle(): class NonNativeEndiannessNumpyPickler(NumpyPickler): def save(self, obj): if isinstance(obj, np.ndarray): - obj = obj.byteswap().newbyteorder() + obj = obj.byteswap().view(obj.dtype.newbyteorder()) super().save(obj) def get_joblib_pickle_non_native_endianness():