-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC/API: Styler documentation changes #13225
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
Conversation
to the entire DataFrame at once with ``axis=None``. | ||
subset: IndexSlice | ||
to the entire DataFrame at once with ``axis=None`` | ||
subset : IndexSlice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we don't have a space before the :
? in general I mean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The examples here do: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#sections, but I don't think it's enforced, does pandas have a preference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure we are consistent as have seen both ways (or does it even format differently)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wrong - it does specify spaces on both sides
(contrast this to linting which doesn't have s space - but different issue)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it definitly specify spaces on both sides, it's a comment I often give when reviewing docstrings ... :-) (and it is needed to get the html formatting correctly using numpydoc, don't know if napoleon is more flexible)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should have a commit hook to check this? or lint check or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://gitlab.com/pycqa/flake8-docstrings anyone try?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last time I looked for something like this, it only checked for pep257, and not for numpydoc specific things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there seems some discussion/work under way: PyCQA/pydocstyle#129
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes that looks good / we should follow that release
@TomAugspurger Did you change a lot in the notebook itself? (Or other phrased: is it worth reviewing? Because online the diff is not shown) |
@jorisvandenbossche the notebook changes were Added:
and
The reason the diff is so big is that I deleted all the output from the notebook committed to the repo. |
@TomAugspurger what about have a shape check when using |
I'll push that change tonight, it's pretty easy, just need tests. |
gr8! @TomAugspurger better to have an exception than documentation. Further no issues with restricting |
4175e4b
to
375676d
Compare
Sorry for the delay, pushed changes.
I put the second one in place to avoid confusing output like Only the top row gets colored, even though the output was 2x2. Edit: added a whatsnew. |
69f91cb
to
6b0a9c6
Compare
6b0a9c6
to
cb28ca4
Compare
Sorry, forgot this was still open. Here are the relevant changes to the notebook
and
and
|
cb28ca4
to
0a06820
Compare
Current coverage is 84.33%@@ master #13225 diff @@
==========================================
Files 138 138
Lines 51068 51080 +12
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43065 43080 +15
+ Misses 8003 8000 -3
Partials 0 0
|
@@ -81,7 +81,7 @@ have ``sphinx`` and ``ipython`` installed. `numpydoc | |||
<https://github.com/numpy/numpydoc>`_ is used to parse the docstrings that | |||
follow the Numpy Docstring Standard (see above), but you don't need to install | |||
this because a local copy of ``numpydoc`` is included in the pandas source | |||
code. | |||
code. To build the Jupyter notebooks included in the documentation, you'll need `nbconvert <https://nbconvert.readthedocs.io/en/latest/>`_ and `nbformat <http://nbformat.readthedocs.io/en/latest/>`_. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might also have this same documenation in contributing.rst
so update there as well (as well as some info on what deps you need to build the docs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can just include this file in contributing.rst, to not duplicate things (I thought it was done like that before)
result = func(data, **kwargs) | ||
if not isinstance(result, pd.DataFrame): | ||
raise TypeError("Function {!r} must return a DataFrame when " | ||
"passed to `Styler.apply` with axis=None") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a .format(..)
missing? (given the {!r}
)
@TomAugspurger Does it build locally for you? (the docs) As on travis there is an error "InputError: [Errno 2] No such file or directory: 'source/html-styling.html'" (not sure if that means that something went wrong ..) |
- Update docstring on output shapes matching - Change build process API: Enforce output shape requirements on Styler.apply
0a06820
to
3ac4895
Compare
Addressed all the comments, thanks. @jorisvandenbossche it does build locally, running from |
Let's see how the travis docs will look like after it is merged. |
Closes #13222, #13225
Second commit puts some more restrictions on the output of a user's function passed to
.apply
.