-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: update the pandas.core.resample.Resampler.backfill docstring #20083
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
When I run
I tested with other modules inside pandas.core, e.g., |
cc @datapythonista, @jorisvandenbossche that's because @gcbeltramini this should fix it for you for testing, but I think we'll handle all these in a separate PR. diff --git a/doc/make.py b/doc/make.py
index 4967f3045..f1b63cf13 100755
--- a/doc/make.py
+++ b/doc/make.py
@@ -349,6 +349,7 @@ def main():
os.environ['PYTHONPATH'] = args.python_path
sys.path.append(args.python_path)
globals()['pandas'] = importlib.import_module('pandas')
+ importlib.import_module('pandas.core.resample')
builder = DocBuilder(args.num_jobs, not args.no_api, args.single,
args.verbosity) |
Codecov Report
@@ Coverage Diff @@
## master #20083 +/- ##
==========================================
+ Coverage 91.72% 91.72% +<.01%
==========================================
Files 150 150
Lines 49122 49152 +30
==========================================
+ Hits 45057 45086 +29
- Misses 4065 4066 +1
Continue to review full report at Codecov.
|
Thanks @TomAugspurger! I edited the file |
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.
Very good overall, I found some minor suggestions.
pandas/core/resample.py
Outdated
@@ -519,21 +519,55 @@ def nearest(self, limit=None): | |||
|
|||
def backfill(self, limit=None): | |||
""" | |||
Backward fill the values | |||
Backward fill the values. | |||
|
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.
It might be interesting to add a more thorough explanation of what exactly is a backward fill for novice users who have never seem this term. Something along the lines of: 'get all the NA values and substitute with the value on the next row that has a non-NA value'
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.
if you can find a wikipedia reference would be great as well.
pandas/core/resample.py
Outdated
|
||
Parameters | ||
---------- | ||
limit : integer, optional | ||
limit of how many values to fill | ||
Limit of how many values to fill. | ||
|
||
Returns | ||
------- | ||
an upsampled Series |
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've seen some examples on https://python-sprints.github.io/pandas/guide/pandas_docstring.html, which would be along the lines of:
Returns
Series
An upsampled Series with backward filled NA values
pandas/core/resample.py
Outdated
@@ -519,21 +519,55 @@ def nearest(self, limit=None): | |||
|
|||
def backfill(self, limit=None): | |||
""" | |||
Backward fill the values | |||
Backward fill the values. | |||
|
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.
if you can find a wikipedia reference would be great as well.
|
||
See Also | ||
-------- | ||
Series.fillna | ||
DataFrame.fillna |
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.
can you add a Resampler.pad, nearest, and fillna refs @jorisvandenbossche how do we reference these exactly here?
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.
It might be you can simply refer to them as 'pad', 'nearest', .. because they live on the same class. But need to check.
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.
If I run python make.py --single pandas.core.resample.Resampler.backfill
, the links are never created. But if I run python make.py html
, the links are created correctly if I use: pandas.Series.fillna
(Series.fillna
and pandas.core.series.Series.fillna
don't work) and fillna
or Resampler.fillna
.
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.
lgtm
Didn't do that much ts resampling myself, and I learned a lot from these changes. Great piece of documentation.
Thanks all. @gcbeltramini if you could check http://pandas-docs.github.io/pandas-docs-travis/generated/pandas.core.resample.Resampler.backfill.html when https://travis-ci.org/pandas-dev/pandas/jobs/352298397 finishes to see if the links render correctly, we'd appreciate it. |
note @TomAugspurger the docs are not actually built because we are not changing any rst files. I just forced a doc-build (though this one is not included as was after). we could just disable this check (in build_docs) for say this week |
Ah good to know, thanks.
…On Mon, Mar 12, 2018 at 7:26 AM, Jeff Reback ***@***.***> wrote:
note @TomAugspurger <https://github.com/tomaugspurger> the docs are not
actually built because we are not changing any rst files. I just forced a
doc-build (though this one is not included as was after). we *could* just
disable this check (in build_docs) for say this week
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#20083 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIvogx3NgVUsObLKfHVFzfNyVSnu0ks5tdmmKgaJpZM4SktPj>
.
|
I changed this recently, docs are now always built (exactly for this reason, we always want to build the docs) |
Ah, no, I changed it in a PR that is not yet merged .. :) |
ahh ok, yeah, go ahead and merge that then :> |
Checklist for the pandas documentation sprint:
scripts/validate_docstrings.py pandas.core.resample.Resampler.backfill
git diff upstream/master -u -- "*.py" | flake8 --diff
python make.py --single pandas.core.resample.Resampler.backfill
(after the modification suggested here)
Please include the output of the validation script below between the "```" ticks: