Skip to content
Merged
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ Deprecations
- :func:`pandas.json_normalize` is now exposed in the top-level namespace.
Usage of ``json_normalize`` as ``pandas.io.json.json_normalize`` is now deprecated and
it is recommended to use ``json_normalize`` as :func:`pandas.json_normalize` instead (:issue:`27586`).
- The ``numpy`` argument of :meth:`pandas.read_json` is deprecated (:issue:`28512`).
- :meth:`DataFrame.to_stata`, :meth:`DataFrame.to_feather`, and :meth:`DataFrame.to_parquet` argument "fname" is deprecated, use "path" instead (:issue:`23574`)
- The deprecated internal attributes ``_start``, ``_stop`` and ``_step`` of :class:`RangeIndex` now raise a ``FutureWarning`` instead of a ``DeprecationWarning`` (:issue:`26581`)

Expand Down
4 changes: 4 additions & 0 deletions pandas/io/json/_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from pandas._libs.tslibs import iNaT
from pandas._typing import JSONSerializable
from pandas.errors import AbstractMethodError
from pandas.util._decorators import deprecate_kwarg

from pandas.core.dtypes.common import ensure_str, is_period_dtype

Expand Down Expand Up @@ -346,6 +347,7 @@ def _write(
return serialized


@deprecate_kwarg(old_arg_name="numpy", new_arg_name=None)
def read_json(
path_or_buf=None,
orient=None,
Expand Down Expand Up @@ -459,6 +461,8 @@ def read_json(
non-numeric column and index labels are supported. Note also that the
JSON ordering MUST be the same for each term if numpy=True.

.. deprecated:: 1.0.0

precise_float : bool, default False
Set to enable usage of higher precision (strtod) function when
decoding string to double values. Default (False) is to use fast but
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/io/json/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1606,3 +1606,11 @@ def test_emca_262_nan_inf_support(self):
["a", np.nan, "NaN", np.inf, "Infinity", -np.inf, "-Infinity"]
)
tm.assert_frame_equal(result, expected)

@pytest.mark.filterwarnings("ignore:the 'numpy' keyword:FutureWarning")
def test_deprecate_numpy_argument_read_json(self):
# GH 28512
expected = DataFrame([1, 2, 3])
with tm.assert_produces_warning(FutureWarning):
result = read_json(expected.to_json(), numpy=True)
tm.assert_frame_equal(result, expected)
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ xfail_strict = True
filterwarnings =
error:Sparse:FutureWarning
error:The SparseArray:FutureWarning
ignore: the 'numpy' keyword is deprecated:FutureWarning
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't do this, instead wrap the appropriate tests


[coverage:run]
branch = False
Expand Down