Skip to content

TST: fixed eng_formatter doctest for #42671 #42705

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 26 commits into from
Jul 30, 2021

Conversation

KrishnaSai2020
Copy link
Contributor

@KrishnaSai2020 KrishnaSai2020 commented Jul 25, 2021

@KrishnaSai2020 KrishnaSai2020 changed the title fixed eng_formatter doctest for #42671 tst: fixed eng_formatter doctest for #42671 Jul 25, 2021
@KrishnaSai2020 KrishnaSai2020 changed the title tst: fixed eng_formatter doctest for #42671 TST: fixed eng_formatter doctest for #42671 Jul 25, 2021
@KrishnaSai2020
Copy link
Contributor Author

I'm quite confused as to why these CI checks failed/were cancelled. can someone help me with this?

@KrishnaSai2020 KrishnaSai2020 marked this pull request as draft July 25, 2021 12:13
@KrishnaSai2020 KrishnaSai2020 marked this pull request as ready for review July 25, 2021 12:13
@fangchenli
Copy link
Member

fangchenli commented Jul 25, 2021

I'm quite confused as to why these CI checks failed/were cancelled. can someone help me with this?

The windows build timed out. It happens sometimes. And it's unrelated to this PR.

Copy link
Member

@fangchenli fangchenli left a comment

Choose a reason for hiding this comment

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

If this fixed all doctest errors in that file/folder, could you add it to the ci/code_checks.sh script?

@KrishnaSai2020
Copy link
Contributor Author

This fixed one doctest error in that file but I don't know about the whole directory. so I added just the file itself.

@datapythonista
Copy link
Member

Thanks @KrishnaSai2020. This doctest is still failing in the file, do you want to fix it here too?

FAILED pandas/io/formats/format.py::pandas.io.formats.format.EngFormatter.__call__

@KrishnaSai2020
Copy link
Contributor Author

@datapythonista I am quite confused as this pr is fixing that particular doctest are you saying the fix doesn't work?

@datapythonista
Copy link
Member

@datapythonista I am quite confused as this pr is fixing that particular doctest are you saying the fix doesn't work?

You fixed one method docstring, that's fine. And then you're validating the doctests of the file where you fixed the docstring. The problem is that the file has many other methods, and most of them pass the tests, but the one I mentioned above is failing.

So, we have two options:

  • You don't validate the file, since not all doctests in it are passing. There were two broken, afyer your PR there is one broken
  • You leave the validation of the file, but besidea the doctest that you fixed, you fix the other brokem one too

@KrishnaSai2020
Copy link
Contributor Author

KrishnaSai2020 commented Jul 26, 2021

I don't mind fixing the other docstrings as well but the reason I was confused is you have mentioned the same one
pandas/io/formats/format.py::pandas.io.formats.format.EngFormatter.__call__ is the same function that this pr resolves.

@datapythonista
Copy link
Member

True, I assumed it was a different one. Your fix is not working, there are other problems in the docstring. You should run the doctests locally to make sure it's fixed. This is the error (the first one, of there is more than one): https://github.com/pandas-dev/pandas/pull/42705/checks?check_run_id=3154916570#step:9:102

@KrishnaSai2020
Copy link
Contributor Author

KrishnaSai2020 commented Jul 26, 2021

I am trying to run the doctests locally but I am getting a whole swathe of unrelated errors on pycharm such as File "/Users/krishnachivukula/Documents/pandas/pandas/_libs/__init__.py", line 13, in <module> from pandas._libs.interval import Interval ModuleNotFoundError: No module named 'pandas._libs.interval' . Anyways on a more relevant note, there was an issue fundamentally with the class itself which I have now hopefully have fixed. formatting 0 should just return 0, not 0E+00 which was overlooked.

@pep8speaks
Copy link

pep8speaks commented Jul 26, 2021

Hello @KrishnaSai2020! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-07-30 08:16:27 UTC

Copy link
Contributor Author

@KrishnaSai2020 KrishnaSai2020 left a comment

Choose a reason for hiding this comment

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

Pycharm auto formatted by accident will revert changes

@KrishnaSai2020
Copy link
Contributor Author

@datapythonista sorry for the spam of commits pycharm decided to autoformat the whole file for me and I had to roll back the changes.

@KrishnaSai2020
Copy link
Contributor Author

1963 >>> format_eng(1000000) # for self.accuracy = 1, Expected: # self.use_eng_prefix = True ' 1.0M' Got: ' 1E+06'
this to me suggests an error with the eng formatter code itself unrelated to the docstring. should I open an issue?

@KrishnaSai2020
Copy link
Contributor Author

KrishnaSai2020 commented Jul 27, 2021

@datapythonista no problem and thanks for your help. I will take definitely take a look at the pep8 validation scripts for the docs too at a later time.

@jreback jreback added this to the 1.4 milestone Jul 28, 2021
@jreback jreback added Docs Testing pandas testing functions or related to the test suite labels Jul 28, 2021
@jreback
Copy link
Contributor

jreback commented Jul 28, 2021

@KrishnaSai2020 if you merge master this should now be green.

@KrishnaSai2020
Copy link
Contributor Author

KrishnaSai2020 commented Jul 28, 2021

@jreback thank you! I have now merged upstream master into this branch.

@KrishnaSai2020
Copy link
Contributor Author

@datapythonista Could I get an update as to what is going to happen with this pr, please? Is it going to get merged? or have I done something wrong which means it can't get merged?

@datapythonista
Copy link
Member

We need to get the CI green first, otherwise we can't merge. Can you merge master again, see if that fixes the issues, and if not, have a look and see what's the problem. Mostly the CI / Checks build, the others are likely to be unrelated.

@KrishnaSai2020
Copy link
Contributor Author

KrishnaSai2020 commented Jul 29, 2021

I think the issue is with stylerender.py doctests. I've removed them now and let's see what happens.

@KrishnaSai2020
Copy link
Contributor Author

KrishnaSai2020 commented Jul 29, 2021

I've merged master again and some completely unrelated doctests are still failing.

@datapythonista
Copy link
Member

I created #42798 for it, we'll have to wait for that issue to be fixed, and then merge master again.

@KrishnaSai2020
Copy link
Contributor Author

KrishnaSai2020 commented Jul 30, 2021

@datapythonista all CI/checks have now passed

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.

Thanks @KrishnaSai2020, really nice.

@fangchenli do you want to have another look?

@jreback jreback merged commit 1e88d66 into pandas-dev:master Jul 30, 2021
@jreback
Copy link
Contributor

jreback commented Jul 30, 2021

thanks @KrishnaSai2020

@KrishnaSai2020 KrishnaSai2020 deleted the doctest-fix-2 branch July 30, 2021 15:57
Leonardofreua pushed a commit to Leonardofreua/pandas that referenced this pull request Jul 30, 2021
attack68 added a commit that referenced this pull request Jul 31, 2021
* TST: Fix doctests for pandas.io.formats.style

* Modified: pandas/io/formats/style.py

* Added some expected results

* Skipped some tests

* TST: Add link to redirect to Table Visualization user guide

* Modified style.py

* Updated the doctest of the apply()

* Updated the doctest of the applymap()

* Updated the doctest of the set_table_styles()

* Updated the doctest of the set_properties()

* TST: Add image to pipe function result

* Modified style.py

* Updated the doctest of the pipe()

* TST: Remove unnecessary outputs

* Modified pandas/io/formats/style.py

* Updated the doctests of the set_tooltips()

* Updated the doctests of the to_latex()

* Updated the doctests of the set_td_classes()

* Updated the doctests of the set_table_attributes()

* TST: Add the output to the Styler.format doctest in to_latex()

* REG: DataFrame.agg where func returns lists and axis=1 (#42762)

* Fix typing issues for CI (#42770)

* BUG: groupby.shift returns different columns when fill_value is specified (#41858)

* PERF: extract_array earlier in DataFrame construction (#42774)

* ENH: `sparse_columns` and `sparse_index` added to `Styler.to_html`  (#41946)

* TYP: Fix typing for searchsorted (#42788)

* DOC GH42756 Update documentation for pandas.DataFrame.drop to clarify tuples. (#42789)

* CI: Fix doctests (#42790)

* REGR: nanosecond timestamp comparisons to OOB datetimes (#42796)

* COMPAT: MPL 3.4.0 (#42803)

* Delete duplicates and unused code from reshape tests (#42802)

* REGR: ValueError raised when both prefix and names are set to None (#42690)

* REGR: ValueError raised when both prefix and names are set to None

* Update readers.py

* whitespace

* Update v1.3.1.rst

* Update v1.3.2.rst

* Update readers.py

* Update readers.py

Co-authored-by: Jeff Reback <[email protected]>

* TST: Add style.py to the doctest check

* TST: fixed eng_formatter doctest for #42671 (#42705)

* TST: Revert x and y position in some doctests

* Updated the doctest of the hide_columns()

Co-authored-by: Richard Shadrach <[email protected]>
Co-authored-by: Irv Lustig <[email protected]>
Co-authored-by: Thomas Smith <[email protected]>
Co-authored-by: jbrockmendel <[email protected]>
Co-authored-by: attack68 <[email protected]>
Co-authored-by: Mike Phung <[email protected]>
Co-authored-by: Matthew Zeitlin <[email protected]>
Co-authored-by: Thomas Li <[email protected]>
Co-authored-by: Patrick Hoefler <[email protected]>
Co-authored-by: Jeff Reback <[email protected]>
Co-authored-by: Krishna Chivukula <[email protected]>
feefladder pushed a commit to feefladder/pandas that referenced this pull request Sep 7, 2021
feefladder pushed a commit to feefladder/pandas that referenced this pull request Sep 7, 2021
* TST: Fix doctests for pandas.io.formats.style

* Modified: pandas/io/formats/style.py

* Added some expected results

* Skipped some tests

* TST: Add link to redirect to Table Visualization user guide

* Modified style.py

* Updated the doctest of the apply()

* Updated the doctest of the applymap()

* Updated the doctest of the set_table_styles()

* Updated the doctest of the set_properties()

* TST: Add image to pipe function result

* Modified style.py

* Updated the doctest of the pipe()

* TST: Remove unnecessary outputs

* Modified pandas/io/formats/style.py

* Updated the doctests of the set_tooltips()

* Updated the doctests of the to_latex()

* Updated the doctests of the set_td_classes()

* Updated the doctests of the set_table_attributes()

* TST: Add the output to the Styler.format doctest in to_latex()

* REG: DataFrame.agg where func returns lists and axis=1 (pandas-dev#42762)

* Fix typing issues for CI (pandas-dev#42770)

* BUG: groupby.shift returns different columns when fill_value is specified (pandas-dev#41858)

* PERF: extract_array earlier in DataFrame construction (pandas-dev#42774)

* ENH: `sparse_columns` and `sparse_index` added to `Styler.to_html`  (pandas-dev#41946)

* TYP: Fix typing for searchsorted (pandas-dev#42788)

* DOC GH42756 Update documentation for pandas.DataFrame.drop to clarify tuples. (pandas-dev#42789)

* CI: Fix doctests (pandas-dev#42790)

* REGR: nanosecond timestamp comparisons to OOB datetimes (pandas-dev#42796)

* COMPAT: MPL 3.4.0 (pandas-dev#42803)

* Delete duplicates and unused code from reshape tests (pandas-dev#42802)

* REGR: ValueError raised when both prefix and names are set to None (pandas-dev#42690)

* REGR: ValueError raised when both prefix and names are set to None

* Update readers.py

* whitespace

* Update v1.3.1.rst

* Update v1.3.2.rst

* Update readers.py

* Update readers.py

Co-authored-by: Jeff Reback <[email protected]>

* TST: Add style.py to the doctest check

* TST: fixed eng_formatter doctest for pandas-dev#42671 (pandas-dev#42705)

* TST: Revert x and y position in some doctests

* Updated the doctest of the hide_columns()

Co-authored-by: Richard Shadrach <[email protected]>
Co-authored-by: Irv Lustig <[email protected]>
Co-authored-by: Thomas Smith <[email protected]>
Co-authored-by: jbrockmendel <[email protected]>
Co-authored-by: attack68 <[email protected]>
Co-authored-by: Mike Phung <[email protected]>
Co-authored-by: Matthew Zeitlin <[email protected]>
Co-authored-by: Thomas Li <[email protected]>
Co-authored-by: Patrick Hoefler <[email protected]>
Co-authored-by: Jeff Reback <[email protected]>
Co-authored-by: Krishna Chivukula <[email protected]>
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.

TST: Fix doctest in EngFormatter
5 participants