diff --git a/doc/source/whatsnew/v2.0.0.rst b/doc/source/whatsnew/v2.0.0.rst index 3b049f3059666..b215d8b7e695c 100644 --- a/doc/source/whatsnew/v2.0.0.rst +++ b/doc/source/whatsnew/v2.0.0.rst @@ -522,6 +522,7 @@ Removal of prior version deprecations/changes - Removed deprecated global option ``use_inf_as_null`` in favor of ``use_inf_as_na`` (:issue:`17126`) - Removed deprecated module ``pandas.core.index`` (:issue:`30193`) - Removed deprecated alias ``pandas.core.tools.datetimes.to_time``, import the function directly from ``pandas.core.tools.times`` instead (:issue:`34145`) +- Removed deprecated alias ``pandas.io.json.json_normalize``, import the function directly from ``pandas.json_normalize`` instead (:issue:`27615`) - Removed deprecated :meth:`Categorical.to_dense`, use ``np.asarray(cat)`` instead (:issue:`32639`) - Removed deprecated :meth:`Categorical.take_nd` (:issue:`27745`) - Removed deprecated :meth:`Categorical.mode`, use ``Series(cat).mode()`` instead (:issue:`45033`) diff --git a/pandas/__init__.py b/pandas/__init__.py index 048d20f0de72f..1a549c09d22f7 100644 --- a/pandas/__init__.py +++ b/pandas/__init__.py @@ -171,7 +171,7 @@ read_spss, ) -from pandas.io.json import _json_normalize as json_normalize +from pandas.io.json._normalize import json_normalize from pandas.util._tester import test diff --git a/pandas/io/json/__init__.py b/pandas/io/json/__init__.py index 1de1abcdb9920..52c65dd6f0c4e 100644 --- a/pandas/io/json/__init__.py +++ b/pandas/io/json/__init__.py @@ -4,10 +4,6 @@ read_json, to_json, ) -from pandas.io.json._normalize import ( - _json_normalize, - json_normalize, -) from pandas.io.json._table_schema import build_table_schema __all__ = [ @@ -15,7 +11,5 @@ "loads", "read_json", "to_json", - "_json_normalize", - "json_normalize", "build_table_schema", ] diff --git a/pandas/io/json/_normalize.py b/pandas/io/json/_normalize.py index 2e320c6cb9b8f..577d677e7b3a0 100644 --- a/pandas/io/json/_normalize.py +++ b/pandas/io/json/_normalize.py @@ -21,7 +21,6 @@ IgnoreRaise, Scalar, ) -from pandas.util._decorators import deprecate import pandas as pd from pandas import DataFrame @@ -245,7 +244,7 @@ def _simple_json_normalize( return normalised_json_object -def _json_normalize( +def json_normalize( data: dict | list[dict], record_path: str | list | None = None, meta: str | list[str | list[str]] | None = None, @@ -535,8 +534,3 @@ def _recursive_extract(data, path, seen_meta, level: int = 0) -> None: ) result[k] = np.array(v, dtype=object).repeat(lengths) return result - - -json_normalize = deprecate( - "pandas.io.json.json_normalize", _json_normalize, "1.0.0", "pandas.json_normalize" -) diff --git a/pandas/tests/io/json/test_normalize.py b/pandas/tests/io/json/test_normalize.py index 86059c24b1e48..bb72e36f8d6cc 100644 --- a/pandas/tests/io/json/test_normalize.py +++ b/pandas/tests/io/json/test_normalize.py @@ -872,13 +872,6 @@ def test_with_large_max_level(self): output = nested_to_record(input_data, max_level=max_level) assert output == expected - def test_deprecated_import(self): - with tm.assert_produces_warning(FutureWarning): - from pandas.io.json import json_normalize # pylint: disable=reimported - - recs = [{"a": 1, "b": 2, "c": 3}, {"a": 4, "b": 5, "c": 6}] - json_normalize(recs) - def test_series_non_zero_index(self): # GH 19020 data = { diff --git a/scripts/validate_unwanted_patterns.py b/scripts/validate_unwanted_patterns.py index 5bc2a915a1c0e..036ddd40ae137 100755 --- a/scripts/validate_unwanted_patterns.py +++ b/scripts/validate_unwanted_patterns.py @@ -48,7 +48,6 @@ "_registry", "_get_offset", # TODO: remove after get_offset deprecation enforced "_test_parse_iso8601", - "_json_normalize", # TODO: remove after deprecation is enforced "_testing", "_test_decorators", "__version__", # check np.__version__ in compat.numpy.function