You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we blindly copy dask.array and dask.dataframe docstrings from NumPy and Pandas. This allows us to avoid rewriting hundreds of docstrings.
However, this fails when the dask operation and the numpy/pandas operation differ slightly, as often occurs when we support only a subset of functionality. This appears to be confusing users who inspect our documentation, try something out, and then receive an error when it doesn't work (see this example).
There are some efforts to mitigate this, for example derived_from takes a list of unavailable arguments to add to the docstring. However this keyword argument is virtually unused.
Some solutions
Crowd-sourced effort to rewrite docstrings manually
Add disclaimer to all wrapped functions that it is merely a copy
?
Reacted by Paulo Roberto de Oliveira Castro and Paulo Haddad
I'm somewhat more inclined towards option 2 to start because it is simple and comprehensive, if perhaps a bit blunt. We might be able to combine the two in some way, perhaps taking a small docstring from the dask.dataframe/array function and prepending it onto the pandas docstring in some clever way.
""" Docstring for FUNCTION NAME
This Dask function implements most of the functionality of WRAPPED FUNCTION NAME, whose complete docstring is included below. However, this Dask version contains the following alterations:
DOCSTRING FROM DASK FUNCTION
The original docstring follows below:
ORIGINAL DOCSTRING
"""
I've been using dask - thanks for the work. So its time to start giving back. For start, I'm happy to work on this, #1592 and #1606 and see how I get on with. Also happy to sync with anyone already doing so.
I think some sort of re-ordering of the notes + explicit disclaimer would help a lot. There are some extreme cases, like this where all 5 of the listed parameters that are copied from the pandas docstring are not supported.
Does anyone know if the format of the pandas docstrings are consistent enough that we might be able to strip these params out in the derived_from() decorator
Talking with @jsignell, we may want to just strip out parameters that aren't supported by dask.
Rather than
Parameters
----------
rule : DateOffset, Timedelta or str
The offset string or object representing target conversion.
axis : {0 or 'index', 1 or 'columns'}, default 0 (Not supported in Dask)
Which axis to use for up- or down-sampling. For `Series` this
will default to 0, i.e. along the rows. Must be
`DatetimeIndex`, `TimedeltaIndex` or `PeriodIndex`.
closed : {'right', 'left'}, default None
...
We'd have
Parameters
----------
rule : DateOffset, Timedelta or str
The offset string or object representing target conversion.
closed : {'right', 'left'}, default None
...
Notes
------
The following paramerts are not supported by dask
* axis
* ...
@xmnlab thanks for expressing interest in this work! The suggestions that Tom made in this comment: #1815 (comment) and this one: #1815 (comment) are both still up for grabs and should probably be separated out into their own issues. So you could definitely work on either of those.
Other than that I was just going through the rendered docs and seeing if any are derived docs that don't have the disclaimer. I never developed a more systematic approach, but if you do we may be able to finially close this ticket, which would be great!
I think we can close this at this point. There haven't been any issues in a while where people complained about docstrings that were missing the disclaimer, so maybe we hit them all with the brute force approach? Anyone should feel free to reopen if they disagree.
Activity
mrocklin commentedon Nov 28, 2016
I'm somewhat more inclined towards option 2 to start because it is simple and comprehensive, if perhaps a bit blunt. We might be able to combine the two in some way, perhaps taking a small docstring from the dask.dataframe/array function and prepending it onto the pandas docstring in some clever way.
mrocklin commentedon Nov 28, 2016
Perhaps something like this, but better:
soloz commentedon Apr 4, 2017
Hi,
I've been using dask - thanks for the work. So its time to start giving back. For start, I'm happy to work on this, #1592 and #1606 and see how I get on with. Also happy to sync with anyone already doing so.
Should put in a pr over the coming days.
mrocklin commentedon Apr 4, 2017
jaypeedevlin commentedon Feb 14, 2018
I think some sort of re-ordering of the notes + explicit disclaimer would help a lot. There are some extreme cases, like this where all 5 of the listed parameters that are copied from the pandas docstring are not supported.
Does anyone know if the format of the pandas docstrings are consistent enough that we might be able to strip these params out in the
derived_from()decoratormariusvniekerk commentedon Jul 4, 2018
So theoretically the pandas docstrings should be adhering to numpydoc which you might be useful for parsing these.
jakirkham commentedon Aug 8, 2019
I've added this to our core work list for triage.
jsignell commentedon Dec 11, 2019
I was thinking of trying to implement a generic disclaimer as described in this comment #1815 (comment). Do people still think that is a good idea?
TomAugspurger commentedon Feb 27, 2020
Talking with @jsignell, we may want to just strip out parameters that aren't supported by dask.
Rather than
We'd have
or put that next to the dask disclaimer.
TomAugspurger commentedon Feb 27, 2020
It would also be nice if the disclaimer included a link to the original docstring.
That could be :meth:`pandas.DataFrame.resample`, rather than
pandas.core.frame.DataFrame.resample.It's a bit tricky because the API doc location isn't always the same as where the object is defined (pandas.core.frame vs.pandas)
The disclaimer should maybe be in an info box too.
xmnlab commentedon Jun 2, 2020
I want to start contributing to dask and am interested in helping on this issue.
I saw that @jsignell worked on some PRs related to this issue.
is there missing anything to finish this issue? if yes I would be happy to help on that :)
jsignell commentedon Jun 2, 2020
@xmnlab thanks for expressing interest in this work! The suggestions that Tom made in this comment: #1815 (comment) and this one: #1815 (comment) are both still up for grabs and should probably be separated out into their own issues. So you could definitely work on either of those.
Other than that I was just going through the rendered docs and seeing if any are derived docs that don't have the disclaimer. I never developed a more systematic approach, but if you do we may be able to finially close this ticket, which would be great!
xmnlab commentedon Jun 4, 2020
thanks @jsignell for all the information! that sounds good. I will start it this weekend :)
jsignell commentedon Dec 9, 2020
I think we can close this at this point. There haven't been any issues in a while where people complained about docstrings that were missing the disclaimer, so maybe we hit them all with the brute force approach? Anyone should feel free to reopen if they disagree.