diff --git a/requirements.txt b/requirements.txt index a98d0f03e..621636f20 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ pydantic>=2 PyYAML>=5.0.0, <6.1 jinja2>=2.11.1, <3.2 visions[type_image_path]>=0.7.5, <0.7.7 -numpy>=1.16.0, <2 +numpy>=1.16.0, <2.2 # Could be optional # Related to HTML report htmlmin==0.1.12 diff --git a/tests/issues/test_issue397.py b/tests/issues/test_issue397.py index ad952e849..2b93c393a 100644 --- a/tests/issues/test_issue397.py +++ b/tests/issues/test_issue397.py @@ -12,7 +12,7 @@ def test_issue397(): # Note: warnings are expected with np.inf values df = pd.DataFrame.from_dict( { - "float-inf": pd.Series([np.inf, 3.0, 4.0, np.NINF], dtype="float"), + "float-inf": pd.Series([np.inf, 3.0, 4.0, -np.inf], dtype="float"), "integer": pd.Series([3, 4, 5, 6], dtype="int"), "float": pd.Series([3.0, 4.0, np.nan, 6], dtype="float"), "integer-inf": pd.Series([3, np.inf, 5, 7]), diff --git a/tests/issues/test_issue664.py b/tests/issues/test_issue664.py index 75c71bf17..6e9963d3d 100644 --- a/tests/issues/test_issue664.py +++ b/tests/issues/test_issue664.py @@ -10,7 +10,7 @@ def test_issue664(): n = 10000 - df = pd.DataFrame({"a": [np.NaN] * n, "b": ["b"] * n, "c": [pd.NaT] * n}) + df = pd.DataFrame({"a": [np.nan] * n, "b": ["b"] * n, "c": [pd.NaT] * n}) df = df.fillna(value=np.nan) profile = ProfileReport( diff --git a/tests/unit/test_typeset_default.py b/tests/unit/test_typeset_default.py index 6afe08dbd..20eb097ec 100644 --- a/tests/unit/test_typeset_default.py +++ b/tests/unit/test_typeset_default.py @@ -1,5 +1,7 @@ import os -from typing import Dict +from typing import Dict, Sequence + +from urllib.parse import urlparse import numpy as np import pandas as pd @@ -18,6 +20,61 @@ from ydata_profiling.model.typeset import ProfilingTypeSet from ydata_profiling.profile_report import ProfileReport +def get_sequences() -> Dict[str, Sequence]: + sequences = { + "complex_series_float": [ + complex(0, 0), + complex(1, 0), + complex(3, 0), + complex(-1, 0), + ], + "url_nan_series": [ + urlparse("http://www.cwi.nl:80/%7Eguido/Python.html"), + urlparse("https://github.com/dylan-profiling/hurricane"), + np.nan, + ], + "mixed": [True, False, np.nan], + "float_nan_series": [1.0, 2.5, np.nan], + "float_series5": [np.nan, 1.2], + "float_with_inf": [np.inf, -np.inf, 1000000.0, 5.5], + "inf_series": [np.inf, -np.inf], + "int_nan_series": [1, 2, np.nan], + "nan_series": [np.nan], + "nan_series_2": [np.nan, np.nan, np.nan, np.nan], + "string_num_nan": ["1.0", "2.0", np.nan], + "string_with_sep_num_nan": ["1,000.0", "2.1", np.nan], + "string_flt_nan": ["1.0", "45.67", np.nan], + "string_str_nan": [ + "I was only robbing the register,", + "I hope you understand", + "One of us had better call up the cops", + "In the hot New Jersey night", + np.nan, + ], + "float_series3": np.array([1.2, 2, 3, 4], dtype=np.float64), + "np_uint32": np.array([1, 2, 3, 4], dtype=np.uint32), + "string_np_unicode_series": np.array(["upper", "hall"], dtype=np.str_), + "complex_series": [ + complex(0, 0), + complex(1, 2), + complex(3, -1), + ], + "bool_series3": np.array([1, 0, 0, 1], dtype=np.bool_), + "complex_series_nan": [complex(0, 0), complex(1, 2), complex(3, -1), None], + "complex_series_nan_2": [ + complex(0, 0), + complex(1, 2), + complex(3, -1), + np.nan, + ], + "complex_series_py_nan": [ + complex(0, 0), + complex(1, 2), + complex(3, -1), + np.nan, + ], + } + return sequences def get_series() -> Dict[str, pd.Series]: """ @@ -25,12 +82,11 @@ def get_series() -> Dict[str, pd.Series]: in pandas 2 and numpy with the value `np.nan * 0j` and `complex(np.nan, np.nan)`. See: https://github.com/numpy/numpy/issues/12919 """ - from visions.backends.numpy.sequences import get_sequences as get_numpy_sequences from visions.backends.pandas.sequences import get_sequences as get_pandas_sequences from visions.backends.python.sequences import get_sequences as get_builtin_sequences sequences = get_builtin_sequences() - sequences.update(get_numpy_sequences()) + sequences.update(get_sequences()) del sequences["complex_series_nan"]