Skip to content

DOC: cleanup docstring for read_json and fix error in contribution guide #27280

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

Merged
merged 8 commits into from
Jul 17, 2019

Conversation

mpmoran
Copy link
Contributor

@mpmoran mpmoran commented Jul 7, 2019

  • closes #xxxx

  • tests added / passed

  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

  • whatsnew entry

  • Contribution Guide

    • fix incorrect paths to doc folder
  • read_json()

    • add period to end of sentences
    • conform parameter types to project standard
    • add newlines for readability and consistency
    • for convert_dates parameter, fix typos and malformed description and add list as accepted type
    • make Returns section conform to project standard

@jreback jreback added the Docs label Jul 8, 2019
@jreback
Copy link
Contributor

jreback commented Jul 8, 2019

cc @datapythonista

@jreback jreback added this to the 0.25.0 milestone Jul 8, 2019
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

You will need to merge master to resolve the conflicts


orient : string,
orient : str,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
orient : str,
orient : str

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the preferred change, according to the docs, would be str, optional. However, the (many) other parameters in the docstring just put the default value. I will make it read str, default None for consistency's sake. I'll leave trudging through the function code and conforming the other parameter descriptions to the preferred style for another day . . .

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the fixes in the contributing guide. Did you check that ./scripts/validate_docstrings.py pandas.read_json doesn't report any error?

@@ -473,7 +478,7 @@ def read_json(

Returns
-------
result : Series or DataFrame, depending on the value of `typ`.
Series or DataFrame, depending on the value of `typ`.
Copy link
Member

Choose a reason for hiding this comment

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

Our standard is to leave just the type Series or DataFrame in this line, and in the next indented to add any explanation. If you can update here, that would be great.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

@mpmoran
Copy link
Contributor Author

mpmoran commented Jul 8, 2019

  • New changes to read_json docstring in a92642d:
    • Remove colon after default for path_or_buf parameter
    • Add default value for orient parameter (addresses hanging comma, see comment above)
    • Fix error on typ parameter by adding set of accepted values and a description
    • Fix error in Returns section by moving description to second line (see comment above)
    • Fix error in See Also section by adding description to DataFrame.to_json (see comment above)
    • Add Series.to_json to See Also section

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

Regarding the examples, if you can open an issue for those that would be great. I don't have a solution for that right now, will require some research.

The default None vs optional we do the following. If the None means None like you're specifying a fill value and the default is filling with None values, when we use default None. If None means doesn't apply, don't do whatever... then we use optional. For example, in the chunksize, None means do not chunk, not a chunk size, so that should be optional. If you don't mind fixing those.

Also, when we specify list, if it makes sense, better to use list of str...

For the rest looks good. Thanks!

@mpmoran
Copy link
Contributor Author

mpmoran commented Jul 9, 2019

Issue has been opened. #27308

And the fixes to the type hints have been made.

@jreback
Copy link
Contributor

jreback commented Jul 17, 2019

can you merge master

@jreback jreback removed this from the 0.25.0 milestone Jul 17, 2019
Resolve merge conflict by accepting upstream changes.
@mpmoran
Copy link
Contributor Author

mpmoran commented Jul 17, 2019

Done.

@TomAugspurger TomAugspurger added this to the 0.25.0 milestone Jul 17, 2019
@TomAugspurger TomAugspurger merged commit 957f5e7 into pandas-dev:master Jul 17, 2019
@TomAugspurger
Copy link
Contributor

Thanks @mpmoran!

another-green pushed a commit to another-green/pandas that referenced this pull request Jul 20, 2019
…ide (pandas-dev#27280)

* DOC: cleanup docstring for read_json and fix error in contribution guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants