Skip to content

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

Merged
merged 3 commits into from
Mar 29, 2018
Merged

Conversation

pulkitmaloo
Copy link
Contributor

@pulkitmaloo pulkitmaloo commented Mar 20, 2018

Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):

  • PR title is "DOC: update the docstring"
  • The validation script passes: scripts/validate_docstrings.py <your-function-or-method>
  • The PEP8 style check passes: git diff upstream/master -u -- "*.py" | flake8 --diff
  • The html version looks good: python doc/make.py --single <your-function-or-method>
  • It has been proofread on language by another sprint participant

Please include the output of the validation script below between the "```" ticks:

# paste output of "scripts/validate_docstrings.py <your-function-or-method>" here
# between the "```" (remove this comment, but keep the "```")

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):

@codecov
Copy link

codecov bot commented Mar 20, 2018

Codecov Report

Merging #20424 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 90.23% <ø> (+0.01%) ⬆️
#single 41.9% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/config_init.py 99.24% <0%> (-0.76%) ⬇️
pandas/core/generic.py 95.85% <0%> (-0.01%) ⬇️
pandas/core/strings.py 98.32% <0%> (ø) ⬆️
pandas/io/formats/format.py 98.24% <0%> (ø) ⬆️
pandas/core/frame.py 97.18% <0%> (ø) ⬆️
pandas/core/panel.py 97.29% <0%> (ø) ⬆️
pandas/core/series.py 93.85% <0%> (ø) ⬆️
pandas/plotting/_converter.py 66.81% <0%> (+1.73%) ⬆️
pandas/io/formats/terminal.py 20.98% <0%> (+4.54%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cdfce2b...cd338bb. Read the comment docs.

@pulkitmaloo
Copy link
Contributor Author

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.
Copy link
Contributor

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).

.. 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.
Copy link
Contributor

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.

@@ -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
Copy link
Contributor

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.

@@ -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')``
Copy link
Contributor

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"

@@ -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
Copy link
Contributor

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`.


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>`.
Copy link
Member

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)

Copy link
Contributor

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?

Copy link
Contributor Author

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.

@TomAugspurger TomAugspurger added this to the 0.23.0 milestone Mar 29, 2018
@TomAugspurger TomAugspurger merged commit 14889f1 into pandas-dev:master Mar 29, 2018
@TomAugspurger
Copy link
Contributor

Thanks @pulkitmaloo !

javadnoorb pushed a commit to javadnoorb/pandas that referenced this pull request Mar 29, 2018
kornilova203 pushed a commit to kornilova203/pandas that referenced this pull request Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sum() or prod() on an empty of all-NaN series
3 participants