-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Fixing EX01 - Added examples #53948
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 6 commits
097da79
1001ed4
8a2b237
6882d04
1ec444f
25600de
c1edff9
60909e4
b513331
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 |
---|---|---|
|
@@ -1900,7 +1900,19 @@ def count(self, numeric_only: bool = False): | |
create_section_header("Returns"), | ||
template_returns, | ||
create_section_header("See Also"), | ||
template_see_also[:-1], | ||
template_see_also, | ||
create_section_header("Examples"), | ||
dedent( | ||
""" | ||
>>> ser = pd.Series([1, 6, 5, 4]) | ||
>>> ser.rolling(2).apply(lambda s: s.sum() - s.min()) | ||
0 NaN | ||
1 6.0 | ||
2 6.0 | ||
3 5.0 | ||
dtype: float64 | ||
""" | ||
).replace("\n", "", 1), | ||
window_method="rolling", | ||
aggregation_description="custom aggregation function", | ||
agg_method="apply", | ||
|
@@ -2008,7 +2020,19 @@ def sum( | |
create_section_header("See Also"), | ||
template_see_also, | ||
create_section_header("Notes"), | ||
numba_notes[:-1], | ||
numba_notes, | ||
create_section_header("Examples"), | ||
dedent( | ||
""" | ||
>>> ser = pd.Series([1, 2, 3, 4]) | ||
>>> ser.rolling(2).max() | ||
0 NaN | ||
1 2.0 | ||
2 3.0 | ||
3 4.0 | ||
dtype: float64 | ||
""" | ||
).replace("\n", "", 1), | ||
window_method="rolling", | ||
aggregation_description="maximum", | ||
agg_method="max", | ||
|
@@ -2288,7 +2312,25 @@ def var( | |
"scipy.stats.skew : Third moment of a probability density.\n", | ||
template_see_also, | ||
create_section_header("Notes"), | ||
"A minimum of three periods is required for the rolling calculation.\n", | ||
dedent( | ||
""" | ||
A minimum of three periods is required for the rolling calculation.\n | ||
""" | ||
).replace("\n", "", 1), | ||
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. can we remove this replace too? 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. ouch - sure. 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. ah I see, thanks - maybe we can remove the rest as part of a separate PR? 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. Sure |
||
create_section_header("Examples"), | ||
dedent( | ||
""" | ||
>>> ser = pd.Series([1, 5, 2, 7, 12, 6]) | ||
>>> ser.rolling(3).skew().round(6) | ||
0 NaN | ||
1 NaN | ||
2 1.293343 | ||
3 -0.585583 | ||
4 0.000000 | ||
5 1.545393 | ||
dtype: float64 | ||
""" | ||
).replace("\n", "", 1), | ||
window_method="rolling", | ||
aggregation_description="unbiased skewness", | ||
agg_method="skew", | ||
|
@@ -2538,7 +2580,20 @@ def rank( | |
create_section_header("Returns"), | ||
template_returns, | ||
create_section_header("See Also"), | ||
template_see_also[:-1], | ||
template_see_also, | ||
create_section_header("Examples"), | ||
dedent( | ||
""" | ||
>>> ser1 = pd.Series([1, 2, 3, 4]) | ||
>>> ser2 = pd.Series([1, 4, 5, 8]) | ||
>>> ser1.rolling(2).cov(ser2) | ||
0 NaN | ||
1 1.5 | ||
2 0.5 | ||
3 1.5 | ||
dtype: float64 | ||
""" | ||
).replace("\n", "", 1), | ||
MarcoGorelli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
window_method="rolling", | ||
aggregation_description="sample covariance", | ||
agg_method="cov", | ||
|
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.
why are we modifying these? looks like the links work in the latest release:
https://pandas.pydata.org/docs/reference/api/pandas.core.window.rolling.Rolling.apply.html
but they don't work here
https://pandas.pydata.org/preview/53948/docs/reference/api/pandas.core.window.rolling.Rolling.apply.html#pandas.core.window.rolling.Rolling.apply
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'll put them back. It was to get rid of these errors after running
validate_docstirngs.py
:But I did forget to see the preview again, sorry.
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.
thanks! I'll check again once the new preview renders. this may be a bug in
validate_docstrings
unfortunately