-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Changes from 2 commits
4e1b71a
20f82d2
f2c4ef6
5c6ca76
0cfe90e
d1a2b8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,7 +320,52 @@ def aggregate(self, arg, *args, **kwargs): | |
agg = aggregate | ||
|
||
_shared_docs['sum'] = dedent(""" | ||
%(name)s sum""") | ||
Calculate %(name)s 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.%(name)s : Calling object with Series data | ||
DataFrame.%(name)s : Calling object with DataFrame data | ||
Series.sum : Equivalent method for Series | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ":"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup. Deleted. |
||
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() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blank line between cases There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added one line for each case. |
||
0 NaN | ||
1 NaN | ||
2 6.0 | ||
3 10.0 | ||
4 15.0 | ||
dtype: float64 | ||
>>> s.rolling(3, center=True).sum() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
0 NaN | ||
1 6.0 | ||
2 9.0 | ||
3 12.0 | ||
4 NaN | ||
dtype: float64 | ||
""") | ||
|
||
_shared_docs['mean'] = dedent(""" | ||
%(name)s mean""") | ||
|
@@ -639,7 +684,7 @@ def aggregate(self, arg, *args, **kwargs): | |
agg = aggregate | ||
|
||
@Substitution(name='window') | ||
@Appender(_doc_template) | ||
# @Appender(_doc_template) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't comment, simply remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your comments are valuable and I have deleted necessary code. |
||
@Appender(_shared_docs['sum']) | ||
def sum(self, *args, **kwargs): | ||
nv.validate_window_func('sum', args, kwargs) | ||
|
@@ -1213,7 +1258,7 @@ def apply(self, func, args=(), kwargs={}): | |
return super(Rolling, self).apply(func, args=args, kwargs=kwargs) | ||
|
||
@Substitution(name='rolling') | ||
@Appender(_doc_template) | ||
# @Appender(_doc_template) | ||
@Appender(_shared_docs['sum']) | ||
def sum(self, *args, **kwargs): | ||
nv.validate_rolling_func('sum', args, kwargs) | ||
|
@@ -1452,7 +1497,7 @@ def apply(self, func, args=(), kwargs={}): | |
return super(Expanding, self).apply(func, args=args, kwargs=kwargs) | ||
|
||
@Substitution(name='expanding') | ||
@Appender(_doc_template) | ||
# @Appender(_doc_template) | ||
@Appender(_shared_docs['sum']) | ||
def sum(self, *args, **kwargs): | ||
nv.validate_expanding_func('sum', args, kwargs) | ||
|
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.
Period at end
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.
Done.