Skip to content

Commit 957f5e7

Browse files
mpmoranTomAugspurger
authored andcommitted
DOC: cleanup docstring for read_json and fix error in contribution guide (#27280)
* DOC: cleanup docstring for read_json and fix error in contribution guide
1 parent 2ae5152 commit 957f5e7

File tree

2 files changed

+29
-21
lines changed

2 files changed

+29
-21
lines changed

doc/source/development/contributing.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ complex changes to the documentation as well.
288288
Some other important things to know about the docs:
289289

290290
* The *pandas* documentation consists of two parts: the docstrings in the code
291-
itself and the docs in this folder ``pandas/doc/``.
291+
itself and the docs in this folder ``doc/``.
292292

293293
The docstrings provide a clear explanation of the usage of the individual
294294
functions, while the documentation in this folder consists of tutorial-like
@@ -404,11 +404,11 @@ Building the documentation
404404
~~~~~~~~~~~~~~~~~~~~~~~~~~
405405

406406
So how do you build the docs? Navigate to your local
407-
``pandas/doc/`` directory in the console and run::
407+
``doc/`` directory in the console and run::
408408

409409
python make.py html
410410

411-
Then you can find the HTML output in the folder ``pandas/doc/build/html/``.
411+
Then you can find the HTML output in the folder ``doc/build/html/``.
412412

413413
The first time you build the docs, it will take quite a while because it has to run
414414
all the code examples and build all the generated docstring pages. In subsequent
@@ -448,7 +448,7 @@ You can also specify to use multiple cores to speed up the documentation build::
448448
Open the following file in a web browser to see the full documentation you
449449
just built::
450450

451-
pandas/docs/build/html/index.html
451+
doc/build/html/index.html
452452

453453
And you'll have the satisfaction of seeing your new and improved documentation!
454454

pandas/io/json/_json.py

+25-17
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,10 @@ def read_json(
400400
.. versionadded:: 0.23.0
401401
'table' as an allowed value for the ``orient`` argument
402402
403-
typ : type of object to recover (series or frame), default 'frame'
404-
dtype : boolean or dict, default None
403+
typ : {'frame', 'series'}, default 'frame'
404+
The type of object to recover.
405+
406+
dtype : bool or dict, default None
405407
If True, infer dtypes; if a dict of column to dtype, then use those;
406408
if False, then don't infer dtypes at all, applies only to the data.
407409
@@ -411,7 +413,7 @@ def read_json(
411413
412414
Not applicable for ``orient='table'``.
413415
414-
convert_axes : boolean, default None
416+
convert_axes : bool, default None
415417
Try to convert the axes to the proper dtypes.
416418
417419
For all ``orient`` values except ``'table'``, default is True.
@@ -420,9 +422,9 @@ def read_json(
420422
421423
Not applicable for ``orient='table'``.
422424
423-
convert_dates : boolean, default True
424-
List of columns to parse for dates; If True, then try to parse
425-
datelike columns default is True; a column label is datelike if
425+
convert_dates : bool or list of str, default True
426+
List of columns to parse for dates. If True, then try to parse
427+
datelike columns. A column label is datelike if
426428
427429
* it ends with ``'_at'``,
428430
@@ -432,34 +434,38 @@ def read_json(
432434
433435
* it is ``'modified'``, or
434436
435-
* it is ``'date'``
437+
* it is ``'date'``.
438+
439+
keep_default_dates : bool, default True
440+
If parsing dates, then parse the default datelike columns.
436441
437-
keep_default_dates : boolean, default True
438-
If parsing dates, then parse the default datelike columns
439-
numpy : boolean, default False
442+
numpy : bool, default False
440443
Direct decoding to numpy arrays. Supports numeric data only, but
441444
non-numeric column and index labels are supported. Note also that the
442445
JSON ordering MUST be the same for each term if numpy=True.
443-
precise_float : boolean, default False
446+
447+
precise_float : bool, default False
444448
Set to enable usage of higher precision (strtod) function when
445449
decoding string to double values. Default (False) is to use fast but
446-
less precise builtin functionality
447-
date_unit : string, default None
450+
less precise builtin functionality.
451+
452+
date_unit : str, default None
448453
The timestamp unit to detect if converting dates. The default behaviour
449454
is to try and detect the correct precision, but if this is not desired
450455
then pass one of 's', 'ms', 'us' or 'ns' to force parsing only seconds,
451456
milliseconds, microseconds or nanoseconds respectively.
457+
452458
encoding : str, default is 'utf-8'
453459
The encoding to use to decode py3 bytes.
454460
455461
.. versionadded:: 0.19.0
456462
457-
lines : boolean, default False
463+
lines : bool, default False
458464
Read the file as a json object per line.
459465
460466
.. versionadded:: 0.19.0
461467
462-
chunksize : integer, default None
468+
chunksize : int, optional
463469
Return JsonReader object for iteration.
464470
See the `line-delimited json docs
465471
<http://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#line-delimited-json>`_
@@ -480,11 +486,13 @@ def read_json(
480486
481487
Returns
482488
-------
483-
result : Series or DataFrame, depending on the value of `typ`.
489+
Series or DataFrame
490+
The type returned depends on the value of `typ`.
484491
485492
See Also
486493
--------
487-
DataFrame.to_json
494+
DataFrame.to_json : Convert a DataFrame to a JSON string.
495+
Series.to_json : Convert a Series to a JSON string.
488496
489497
Notes
490498
-----

0 commit comments

Comments
 (0)