Skip to content

Commit 5679b16

Browse files
committed
feat: bump numpy version to support numpy v.2.2
1 parent a542afe commit 5679b16

4 files changed

Lines changed: 62 additions & 6 deletions

File tree

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pydantic>=2
55
PyYAML>=5.0.0, <6.1
66
jinja2>=2.11.1, <3.2
77
visions[type_image_path]>=0.7.5, <0.7.7
8-
numpy>=1.16.0, <2
8+
numpy>=1.16.0, <2.2
99
# Could be optional
1010
# Related to HTML report
1111
htmlmin==0.1.12

tests/issues/test_issue397.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def test_issue397():
1212
# Note: warnings are expected with np.inf values
1313
df = pd.DataFrame.from_dict(
1414
{
15-
"float-inf": pd.Series([np.inf, 3.0, 4.0, np.NINF], dtype="float"),
15+
"float-inf": pd.Series([np.inf, 3.0, 4.0, -np.inf], dtype="float"),
1616
"integer": pd.Series([3, 4, 5, 6], dtype="int"),
1717
"float": pd.Series([3.0, 4.0, np.nan, 6], dtype="float"),
1818
"integer-inf": pd.Series([3, np.inf, 5, 7]),

tests/issues/test_issue664.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
def test_issue664():
1212
n = 10000
13-
df = pd.DataFrame({"a": [np.NaN] * n, "b": ["b"] * n, "c": [pd.NaT] * n})
13+
df = pd.DataFrame({"a": [np.nan] * n, "b": ["b"] * n, "c": [pd.NaT] * n})
1414
df = df.fillna(value=np.nan)
1515

1616
profile = ProfileReport(

tests/unit/test_typeset_default.py

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import os
2-
from typing import Dict
2+
from typing import Dict, Sequence
3+
4+
from urllib.parse import urlparse
35

46
import numpy as np
57
import pandas as pd
@@ -18,19 +20,73 @@
1820
from ydata_profiling.model.typeset import ProfilingTypeSet
1921
from ydata_profiling.profile_report import ProfileReport
2022

23+
def get_sequences() -> Dict[str, Sequence]:
24+
sequences = {
25+
"complex_series_float": [
26+
complex(0, 0),
27+
complex(1, 0),
28+
complex(3, 0),
29+
complex(-1, 0),
30+
],
31+
"url_nan_series": [
32+
urlparse("http://www.cwi.nl:80/%7Eguido/Python.html"),
33+
urlparse("https://github.com/dylan-profiling/hurricane"),
34+
np.nan,
35+
],
36+
"mixed": [True, False, np.nan],
37+
"float_nan_series": [1.0, 2.5, np.nan],
38+
"float_series5": [np.nan, 1.2],
39+
"float_with_inf": [np.inf, -np.inf, 1000000.0, 5.5],
40+
"inf_series": [np.inf, -np.inf],
41+
"int_nan_series": [1, 2, np.nan],
42+
"nan_series": [np.nan],
43+
"nan_series_2": [np.nan, np.nan, np.nan, np.nan],
44+
"string_num_nan": ["1.0", "2.0", np.nan],
45+
"string_with_sep_num_nan": ["1,000.0", "2.1", np.nan],
46+
"string_flt_nan": ["1.0", "45.67", np.nan],
47+
"string_str_nan": [
48+
"I was only robbing the register,",
49+
"I hope you understand",
50+
"One of us had better call up the cops",
51+
"In the hot New Jersey night",
52+
np.nan,
53+
],
54+
"float_series3": np.array([1.2, 2, 3, 4], dtype=np.float64),
55+
"np_uint32": np.array([1, 2, 3, 4], dtype=np.uint32),
56+
"string_np_unicode_series": np.array(["upper", "hall"], dtype=np.str_),
57+
"complex_series": [
58+
complex(0, 0),
59+
complex(1, 2),
60+
complex(3, -1),
61+
],
62+
"bool_series3": np.array([1, 0, 0, 1], dtype=np.bool_),
63+
"complex_series_nan": [complex(0, 0), complex(1, 2), complex(3, -1), None],
64+
"complex_series_nan_2": [
65+
complex(0, 0),
66+
complex(1, 2),
67+
complex(3, -1),
68+
np.nan,
69+
],
70+
"complex_series_py_nan": [
71+
complex(0, 0),
72+
complex(1, 2),
73+
complex(3, -1),
74+
np.nan,
75+
],
76+
}
77+
return sequences
2178

2279
def get_series() -> Dict[str, pd.Series]:
2380
"""
2481
Taken from Vision to remove the `complex_series_nan` that causes an exception due to a bug
2582
in pandas 2 and numpy with the value `np.nan * 0j` and `complex(np.nan, np.nan)`.
2683
See: https://github.com/numpy/numpy/issues/12919
2784
"""
28-
from visions.backends.numpy.sequences import get_sequences as get_numpy_sequences
2985
from visions.backends.pandas.sequences import get_sequences as get_pandas_sequences
3086
from visions.backends.python.sequences import get_sequences as get_builtin_sequences
3187

3288
sequences = get_builtin_sequences()
33-
sequences.update(get_numpy_sequences())
89+
sequences.update(get_sequences())
3490

3591
del sequences["complex_series_nan"]
3692

0 commit comments

Comments
 (0)