Skip to content

DOC: Update the pandas.core.window.x.sum docstring #20272

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 6 commits into from
Mar 14, 2018

Conversation

othersideoflearning
Copy link
Contributor

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

  • [x ] PR title is "DOC: update the docstring"
  • [x ] The validation script passes: scripts/validate_docstrings.py <your-function-or-method>
  • [x ] The PEP8 style check passes: git diff upstream/master -u -- "*.py" | flake8 --diff
  • [x ] The html version looks good: python doc/make.py --single <your-function-or-method>
  • [ x] 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 "```" 
(pandas-dev) D:\GitHub\pandas>python scripts/validate_docstrings.py pandas.core.window.Rolling.sum

################################################################################
################## Docstring (pandas.core.window.Rolling.sum) ##################
################################################################################

Calculate rolling sum of given DataFrame or Series.

Parameters
----------
*args
    Under Review.
**kwargs
    Under Review.

Returns
-------
Series or DataFrame
    Like-indexed object containing the result of function application

See Also
--------
Series.rolling : Calling object with Series data
DataFrame.rolling  : Calling object with DataFrame data
Series.sum  : Equivalent method for Series
DataFrame.sum   : Equivalent method for DataFrame

Examples
--------
>>> s = pd.Series([1, 2, 3, 4, 5])
>>> s.rolling(3).sum()
0     NaN
1     NaN
2     6.0
3     9.0
4    12.0
dtype: float64
>>> s.expanding(3).sum()
0     NaN
1     NaN
2     6.0
3    10.0
4    15.0
dtype: float64
>>> s.rolling(3, center=True).sum()
0     NaN
1     6.0
2     9.0
3    12.0
4     NaN
dtype: float64

################################################################################
################################## Validation ##################################
################################################################################

Errors found:
        No extended summary found
        Errors in parameters section
                Parameters {'kwargs', 'args'} not documented
                Unknown parameters {'**kwargs', '*args'}
                Parameter "*args" has no type
                Parameter "**kwargs" has no type

(pandas-dev) D:\GitHub\pandas>python scripts/validate_docstrings.py pandas.core.window.Expanding.sum

################################################################################
################# Docstring (pandas.core.window.Expanding.sum) #################
################################################################################

Calculate expanding sum of given DataFrame or Series.

Parameters
----------
*args
    Under Review.
**kwargs
    Under Review.

Returns
-------
Series or DataFrame
    Like-indexed object containing the result of function application

See Also
--------
Series.expanding : Calling object with Series data
DataFrame.expanding  : Calling object with DataFrame data
Series.sum  : Equivalent method for Series
DataFrame.sum   : Equivalent method for DataFrame

Examples
--------
>>> s = pd.Series([1, 2, 3, 4, 5])
>>> s.rolling(3).sum()
0     NaN
1     NaN
2     6.0
3     9.0
4    12.0
dtype: float64
>>> s.expanding(3).sum()
0     NaN
1     NaN
2     6.0
3    10.0
4    15.0
dtype: float64
>>> s.rolling(3, center=True).sum()
0     NaN
1     6.0
2     9.0
3    12.0
4     NaN
dtype: float64

################################################################################
################################## Validation ##################################
################################################################################

Errors found:
        No extended summary found
        Errors in parameters section
                Parameters {'kwargs', 'args'} not documented
                Unknown parameters {'**kwargs', '*args'}
                Parameter "*args" has no type
                Parameter "**kwargs" has no type

(pandas-dev) D:\GitHub\pandas>python scripts/validate_docstrings.py pandas.core.window.Window.sum

################################################################################
################## Docstring (pandas.core.window.Window.sum)  ##################
################################################################################

Calculate window sum of given DataFrame or Series.

Parameters
----------
*args
    Under Review.
**kwargs
    Under Review.

Returns
-------
Series or DataFrame
    Like-indexed object containing the result of function application

See Also
--------
Series.window : Calling object with Series data
DataFrame.window  : Calling object with DataFrame data
Series.sum  : Equivalent method for Series
DataFrame.sum   : Equivalent method for DataFrame

Examples
--------
>>> s = pd.Series([1, 2, 3, 4, 5])
>>> s.rolling(3).sum()
0     NaN
1     NaN
2     6.0
3     9.0
4    12.0
dtype: float64
>>> s.expanding(3).sum()
0     NaN
1     NaN
2     6.0
3    10.0
4    15.0
dtype: float64
>>> s.rolling(3, center=True).sum()
0     NaN
1     6.0
2     9.0
3    12.0
4     NaN
dtype: float64

################################################################################
################################## Validation ##################################
################################################################################

Errors found:
        No extended summary found
        Errors in parameters section
                Parameters {'args', 'kwargs'} not documented
                Unknown parameters {'*args', '**kwargs'}
                Parameter "*args" has no type
                Parameter "**kwargs" has no type


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.

Returns
-------
Series or DataFrame
Like-indexed object containing the result of function application
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Period at end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

3 10.0
4 15.0
dtype: float64
>>> s.rolling(3, center=True).sum()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a great example, but maybe add one line or comment for what to expect with center=True

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I have added one line of explanation stating that how this argument helps.

--------
Series.%(name)s : Calling object with Series data
DataFrame.%(name)s : Calling object with DataFrame data
Series.sum : Equivalent method for Series
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace seems off on this line and below - are there more than one before the ":"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup. Deleted.

@jreback jreback added the Reshaping Concat, Merge/Join, Stack/Unstack, Explode label Mar 11, 2018
3 9.0
4 12.0
dtype: float64
>>> s.expanding(3).sum()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line between cases

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added one line for each case.

@@ -639,7 +684,7 @@ def aggregate(self, arg, *args, **kwargs):
agg = aggregate

@Substitution(name='window')
@Appender(_doc_template)
# @Appender(_doc_template)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't comment, simply remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your comments are valuable and I have deleted necessary code.

Changes to the pandas.core.window.x.sum docstring
@pep8speaks
Copy link

pep8speaks commented Mar 11, 2018

Hello @apallekonda! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on March 14, 2018 at 19:29 Hours UTC

Copy link
Contributor Author

@othersideoflearning othersideoflearning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added or deleted necessary code as per comments.

@@ -639,7 +684,7 @@ def aggregate(self, arg, *args, **kwargs):
agg = aggregate

@Substitution(name='window')
@Appender(_doc_template)
# @Appender(_doc_template)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your comments are valuable and I have deleted necessary code.

3 10.0
4 15.0
dtype: float64
>>> s.rolling(3, center=True).sum()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I have added one line of explanation stating that how this argument helps.

3 9.0
4 12.0
dtype: float64
>>> s.expanding(3).sum()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added one line for each case.

--------
Series.%(name)s : Calling object with Series data
DataFrame.%(name)s : Calling object with DataFrame data
Series.sum : Equivalent method for Series
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup. Deleted.

Returns
-------
Series or DataFrame
Like-indexed object containing the result of function application
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@codecov
Copy link

codecov bot commented Mar 14, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@c124e47). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #20272   +/-   ##
=========================================
  Coverage          ?    91.7%           
=========================================
  Files             ?      150           
  Lines             ?    49165           
  Branches          ?        0           
=========================================
  Hits              ?    45087           
  Misses            ?     4078           
  Partials          ?        0
Flag Coverage Δ
#multiple 90.09% <ø> (?)
#single 41.86% <ø> (?)
Impacted Files Coverage Δ
pandas/core/window.py 96.32% <ø> (ø)

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 c124e47...d1a2b8d. Read the comment docs.

@TomAugspurger TomAugspurger added this to the 0.23.0 milestone Mar 14, 2018
[ci skip]
@TomAugspurger TomAugspurger merged commit 002796a into pandas-dev:master Mar 14, 2018
@TomAugspurger
Copy link
Contributor

Thanks @apallekonda !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants