File: 0002-Use-float64-instead-of-float_-for-Numpy2-compatibili.patch

package info (click to toggle)
orange3 3.38.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 45,236 kB
  • sloc: python: 159,527; ansic: 622; makefile: 478; sh: 93; cpp: 77
file content (44 lines) | stat: -rw-r--r-- 1,494 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From: Roland Mas <roland.mas@entierement.net>
Date: Sun, 4 May 2025 14:51:07 +0200
Subject: Use float64 instead of float_ for Numpy2 compatibility

---
 Orange/data/io_base.py | 4 ++--
 Orange/data/util.py    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Orange/data/io_base.py b/Orange/data/io_base.py
index 4b0b74e..df3d715 100644
--- a/Orange/data/io_base.py
+++ b/Orange/data/io_base.py
@@ -381,7 +381,7 @@ class _TableBuilder:
                  (self.cols_W, float))
         X, Y, M, W = [self._list_into_ndarray(lst, dt) for lst, dt in lists]
         if X is None:
-            X = np.empty((self.data.shape[0], 0), dtype=np.float_)
+            X = np.empty((self.data.shape[0], 0), dtype=np.float64)
         return X, Y, M, W
 
     @staticmethod
@@ -393,7 +393,7 @@ class _TableBuilder:
         if dtype is not None:
             array.astype(dtype)
         else:
-            assert array.dtype == np.float_
+            assert array.dtype == np.float64
         return array
 
 
diff --git a/Orange/data/util.py b/Orange/data/util.py
index bee1f7f..79bacea 100644
--- a/Orange/data/util.py
+++ b/Orange/data/util.py
@@ -50,7 +50,7 @@ def scale(values, min=0, max=1):
     """Return values scaled to [min, max]"""
     if len(values) == 0:
         return np.array([])
-    minval = np.float_(bn.nanmin(values))
+    minval = np.float64(bn.nanmin(values))
     ptp = bn.nanmax(values) - minval
     if ptp == 0:
         return np.clip(values, min, max)