-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Update missing_data.rst #20424
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
DOC: Update missing_data.rst #20424
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20424 +/- ##
==========================================
+ Coverage 91.82% 91.84% +0.01%
==========================================
Files 152 152
Lines 49248 49261 +13
==========================================
+ Hits 45222 45243 +21
+ Misses 4026 4018 -8
Continue to review full report at Codecov.
|
|
doc/source/missing_data.rst
Outdated
s.sum() | ||
|
||
Summing over an empty ``Series`` will return ``NaN``: | ||
With ``sum`` on an empty or all-``NaN`` ``Series``, or columns of a ``DataFrame``, the result will be 0. |
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.
Reprhase as
The sum of an empty or all-NA Series or column of a DataFrame is 0.
then the example. Don't need to double backtick Series or DataFrame (we're changing our style for those).
doc/source/missing_data.rst
Outdated
.. warning:: | ||
|
||
These behaviors differ from the default in ``numpy`` where an empty sum returns zero. | ||
With ``prod`` on an empty or all-``NaN`` ``Series``, or columns of a ``DataFrame``, the result will be 1. |
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.
Similar
The product of an empty or all-NA Series or column of a DataFrame is 1.
doc/source/missing_data.rst
Outdated
@@ -242,7 +228,7 @@ with missing data. | |||
Filling missing values: fillna | |||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |||
|
|||
The **fillna** function can "fill in" NA values with non-NA data in a couple | |||
The :meth:`~DataFrame.fillna` function can "fill in" NA values with non-NA data in a couple |
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.
Instead of "The :meth:`method` function", write it as just ":meth:`method`". From the context it's clear that it's a function / method.
doc/source/missing_data.rst
Outdated
@@ -292,8 +278,8 @@ To remind you, these are the available filling methods: | |||
With time series data, using pad/ffill is extremely common so that the "last | |||
known value" is available at every time point. | |||
|
|||
The ``ffill()`` function is equivalent to ``fillna(method='ffill')`` | |||
and ``bfill()`` is equivalent to ``fillna(method='bfill')`` | |||
The :meth:`~DataFrame.ffill` function is equivalent to ``fillna(method='ffill')`` |
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.
Same thing, remove "The" and "function"
doc/source/missing_data.rst
Outdated
@@ -534,7 +520,7 @@ the ``limit_area`` parameter restricts filling to either inside or outside value | |||
Replacing Generic Values | |||
~~~~~~~~~~~~~~~~~~~~~~~~ | |||
Often times we want to replace arbitrary values with other values. The | |||
``replace`` method in Series/DataFrame provides an efficient yet | |||
:meth:`~DataFrame.replace` method in Series/DataFrame provides an efficient yet |
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.
Remove "method". Or write out :meth:`Series.replace` and :meth:`DataFrame.replace`.
doc/source/missing_data.rst
Outdated
|
||
This behavior is now standard as of v0.21.0; previously sum/prod would give different | ||
results if the ``bottleneck`` package was installed. | ||
See the :ref:`v0.21.0 whatsnew <whatsnew_0210.api_breaking.bottleneck>`. |
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.
Do we want to keep some kind of warning that this behaviour recently changed (with a link to the relevant whatsnew 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.
Yes, that's probably best, given the change is so new.
@pulkitmaloo could you add a small note mentioning that, with a link to the 0.22.0 whatsnew?
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.
Sure, I've made the changes. Please review it.
Thanks @pulkitmaloo ! |
Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):
scripts/validate_docstrings.py <your-function-or-method>
git diff upstream/master -u -- "*.py" | flake8 --diff
python doc/make.py --single <your-function-or-method>
Please include the output of the validation script below between the "```" ticks:
If the validation script still gives errors, but you think there is a good reason
to deviate in this case (and there are certainly such cases), please state this
explicitly.
Checklist for other PRs (remove this part if you are doing a PR for the pandas documentation sprint):
git diff upstream/master -u -- "*.py" | flake8 --diff