Skip to content
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

Correct assert_frame_equal doc string #22552

Merged
merged 7 commits into from
Sep 3, 2018
Merged

Conversation

pablojim
Copy link
Contributor

Correct default values in assert_frame_equal doc string

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Can you check that this passes the docstring validation script?

pandas/util/testing.py Outdated Show resolved Hide resolved
@WillAyd WillAyd added the Docs label Aug 31, 2018
@pablojim
Copy link
Contributor Author

@WillAyd

################################## Validation ##################################
################################################################################

Warnings found:
        No extended summary found
        See Also section not found
        No examples section found
Docstring for "pandas.util.testing.assert_frame_equal" correct. :)

@codecov
Copy link

codecov bot commented Aug 31, 2018

Codecov Report

Merging #22552 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #22552   +/-   ##
=======================================
  Coverage   92.04%   92.04%           
=======================================
  Files         169      169           
  Lines       50787    50787           
=======================================
  Hits        46745    46745           
  Misses       4042     4042
Flag Coverage Δ
#multiple 90.45% <ø> (ø) ⬆️
#single 42.29% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 85.75% <ø> (ø) ⬆️
pandas/core/strings.py 98.63% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98fb53c...6a861d7. Read the comment docs.

pandas/util/testing.py Outdated Show resolved Hide resolved
pandas/util/testing.py Outdated Show resolved Hide resolved
check_dtype : bool, default True
Whether to check the DataFrame dtype is identical.
check_index_type : bool / string {'equiv'}, default False
check_index_type : bool / string {'equiv'}, default 'equiv'
Copy link
Member

Choose a reason for hiding this comment

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

I think what we've been using in these cases is {'equiv'} or bool

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO that is more confusing. e.g. it might imply I pass a set. I'm not sure it's worth a special case for when there is only one possible string value.

Copy link
Member

Choose a reason for hiding this comment

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

what is your suggestion, just 'equiv' or bool, default 'equiv' or something else? Besides being more consistent for the user, using the curly brackets in all cases would simplify parsing the types and adding validation and extracting stats. But if you are strongly in favor of not using them, I'm happy to merge this with it now, and see later on what's best when we implement that validation.

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 as it is above is good. It's maybe a little verbose but is very clear.

check_index_type : bool / string {'equiv'}, default 'equiv'

Happy to revisit if a standard emerges.

Copy link
Member

Choose a reason for hiding this comment

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

You have the standard here: https://pandas.pydata.org/pandas-docs/stable/contributing_docstring.html#parameter-types

If you can use the first format I suggested, 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.

Thanks. I have used your suggestion.

pandas/util/testing.py Outdated Show resolved Hide resolved
@datapythonista datapythonista added the Testing pandas testing functions or related to the test suite label Sep 1, 2018
@pep8speaks
Copy link

pep8speaks commented Sep 2, 2018

Hello @pablojim! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on September 03, 2018 at 11:52 Hours UTC

check_dtype : bool, default True
Whether to check the DataFrame dtype is identical.
check_index_type : bool / string {'equiv'}, default False
check_index_type : bool / string {'equiv'}, default 'equiv'
Copy link
Member

Choose a reason for hiding this comment

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

what is your suggestion, just 'equiv' or bool, default 'equiv' or something else? Besides being more consistent for the user, using the curly brackets in all cases would simplify parsing the types and adding validation and extracting stats. But if you are strongly in favor of not using them, I'm happy to merge this with it now, and see later on what's best when we implement that validation.

See Also
--------
assert_series_equal: equivalent method for asserting Series equality
DataFrame.equals: check DataFrame equality
Copy link
Member

Choose a reason for hiding this comment

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

Do you think it makes sense adding a example?

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'm not sure an example is particularly useful in this case.

Copy link
Member

Choose a reason for hiding this comment

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

We've got users of all levels, and things like comparing dataframes with different types are worth showing with examples.

Besides that, can you add a space before the colons in the see also section, capitalize the first letter of the description, and finish the description with a period? If you generate the html ./doc/make.py html --single pandas.util.testing.assert_frame_equal, I don't think without the space this is being rendered correcty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added examples and corrected formatting as mentioned.

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.

There are formatting issues, and I think examples, and also an extended summary that explains that this is mainly used in unit tests, would make the docstring much more useful to users.

See Also
--------
assert_series_equal: equivalent method for asserting Series equality
DataFrame.equals: check DataFrame equality
Copy link
Member

Choose a reason for hiding this comment

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

We've got users of all levels, and things like comparing dataframes with different types are worth showing with examples.

Besides that, can you add a space before the colons in the see also section, capitalize the first letter of the description, and finish the description with a period? If you generate the html ./doc/make.py html --single pandas.util.testing.assert_frame_equal, I don't think without the space this is being rendered correcty.

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.

lgtm, great changes. Thanks @pablojim

@WillAyd WillAyd merged commit db97089 into pandas-dev:master Sep 3, 2018
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants