Skip to content

DEPR: Deprecate numpy argument in read_json #28562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5a5b347
add original changes.
lucaionescu Dec 18, 2019
18bd98f
ENH: Add support for DataFrame(Categorical) (#11363) (#30305)
proost Dec 18, 2019
416907d
DOC: whatsnew fixups (#30331)
TomAugspurger Dec 18, 2019
f36eac1
CLN: changed .format to f-string in pandas/core/dtypes (#30287)
DorAmram Dec 18, 2019
70a083f
Fix typos, via a Levenshtein-style corrector (#30341)
bwignall Dec 19, 2019
20e4c18
TYPING: Enable --check-untyped-defs for MyPy (#29493)
simonjayhawkins Dec 19, 2019
53a0dfd
BUG: Fix infer_dtype_from_scalar to infer IntervalDtype (#30339)
jschendel Dec 19, 2019
5b25df2
API: Return BoolArray for string ops when backed by StringArray (#30239)
TomAugspurger Dec 19, 2019
f8b9ce7
REF: change parameter name fname -> path (#30338)
jbrockmendel Dec 19, 2019
8cbfd06
CLN: make lookups explicit instead of using globals (#30343)
jbrockmendel Dec 19, 2019
2bfd10c
REF: remove pytables Table.metadata (#30342)
jbrockmendel Dec 19, 2019
95e1a63
REF: pytables prepare to make _create_axes return a new object (#30344)
jbrockmendel Dec 19, 2019
e66a2c7
CLN: format replaced with f-strings #29547 (#30355)
hasnain2808 Dec 19, 2019
011a667
replace str.format with f-string (#30363)
AlpAribal Dec 20, 2019
c521a4e
DOC: "Next" link from user_guide/io.rst goes to read_sql_table API pa…
souvik3333 Dec 20, 2019
b4343ef
CI: troubleshoot codecov (#30070)
jbrockmendel Dec 20, 2019
66038e9
BUG+TST: non-optimized apply_index and empty DatetimeIndex (#30336)
jbrockmendel Dec 20, 2019
a9e2566
REF: define NA_VALUES in libparsers (#30373)
jbrockmendel Dec 20, 2019
eadaa40
[CLN] remove now-unnecessary td.skip_if_no(pathlib) (#30376)
MarcoGorelli Dec 20, 2019
1be80ea
REF: directory for method-specific series/frame tests (#30362)
jbrockmendel Dec 20, 2019
a6b047a
REF: refactor cumulative op tests from test_analytics (#30358)
jbrockmendel Dec 20, 2019
9296849
Cleaned up Tempita refs and Cython import (#30330)
WillAyd Dec 20, 2019
6efc237
CLN: Old string formatting: .format() -> f"" (#30328)
baevpetr Dec 20, 2019
0df8858
de-privatize io.common functions (#30368)
jbrockmendel Dec 20, 2019
0cd388f
CLN: remove py2-legacy UnicodeReader, UnicodeWriter (#30371)
jbrockmendel Dec 20, 2019
8376067
CI: troubleshoot codecov (#30380)
jbrockmendel Dec 21, 2019
c869255
CLN: move code out of try clause in merge.py (#30382)
topper-123 Dec 21, 2019
477b2d5
TYP: Annotations in core/indexes/ (#30390)
ShaharNaveh Dec 21, 2019
835f207
DOC: fix external links + favicon (#30389)
jorisvandenbossche Dec 22, 2019
a2bbdb5
STY: Underscores for long numbers (#30397)
ShaharNaveh Dec 22, 2019
104fc11
fix call of tm.assert_frame_equal
lucaionescu Dec 22, 2019
97b182b
add original changes.
lucaionescu Dec 18, 2019
3c8f95b
fix call of tm.assert_frame_equal
lucaionescu Dec 22, 2019
df2671b
merge.
lucaionescu Dec 22, 2019
f46426e
Revert "fix call of tm.assert_frame_equal"
lucaionescu Dec 22, 2019
0be5dd7
Revert "merge."
lucaionescu Dec 22, 2019
16217f0
fix tm.assert_frame_equal. use naming conventions.
lucaionescu Dec 22, 2019
640f729
sort imports correctly.
lucaionescu Dec 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -501,6 +501,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`).
-

.. _whatsnew_1000.prior_deprecations:
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 @@ -10,6 +10,7 @@
import pandas._libs.json as json
from pandas._libs.tslibs import iNaT
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 @@ -353,6 +354,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 @@ -466,6 +468,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
11 changes: 11 additions & 0 deletions pandas/tests/io/json/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from io import StringIO
import json
import os
from warnings import catch_warnings, filterwarnings

import numpy as np
import pytest
Expand Down Expand Up @@ -1601,3 +1602,13 @@ def test_json_indent_all_orients(self, orient, expected):
def test_json_negative_indent_raises(self):
with pytest.raises(ValueError, match="must be a nonnegative integer"):
pd.DataFrame().to_json(indent=-1)

@pytest.mark.filterwarnings("ignore:.*msgpack:FutureWarning")
def test_deprecate_numpy_argument_read_json(self):
# https://github.com/pandas-dev/pandas/issues/28512
expected = DataFrame([1, 2, 3])
with tm.assert_produces_warning(None):
with catch_warnings():
filterwarnings("ignore", category=FutureWarning)
result = read_json(expected.to_json(), numpy=True)
tm.assert_frame_equal(result, expected)