-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Fixing EX01 - Added examples #53982
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 1 commit
d54a6a5
d99e260
a9b17a2
adf84da
4d36890
f541824
324096b
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 |
---|---|---|
|
@@ -1270,7 +1270,32 @@ def aggregate(self, func, *args, **kwargs): | |
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([0, 1, 5, 2, 8]) | ||
|
||
In order to get an instance of pandas.core.window.rolling.Window we need | ||
to pass the parameter `win_type`. | ||
|
||
>>> type(ser.rolling(2, win_type='gaussian')) | ||
<class 'pandas.core.window.rolling.Window'> | ||
|
||
In order to use the `Sci-py` gaussian window we need to provide the parameters | ||
M and std. The parameter M corresponds to 2 in our example. | ||
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 add backticks to the variable names here? Like
The general rule (which admittedly isn't followed very consistently) from the numpy guide is to use single backticks for variable names, and double backticks otherwise 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. Sorry, I forgot about that. |
||
We pass the second parameter std as a parameter of the following method | ||
(`sum` in this case): | ||
|
||
>>> ser.rolling(2, win_type='gaussian').sum(std=3) | ||
0 NaN | ||
1 0.986207 | ||
2 5.917243 | ||
3 6.903450 | ||
4 9.862071 | ||
dtype: float64 | ||
""" | ||
).replace("\n", "", 1), | ||
window_method="rolling", | ||
aggregation_description="weighted window sum", | ||
agg_method="sum", | ||
|
@@ -1295,7 +1320,31 @@ def sum(self, numeric_only: bool = False, **kwargs): | |
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([0, 1, 5, 2, 8]) | ||
|
||
In order to get an instance of pandas.core.window.rolling.Window we need | ||
to pass the parameter `win_type`. | ||
|
||
>>> type(ser.rolling(2, win_type='gaussian')) | ||
<class 'pandas.core.window.rolling.Window'> | ||
|
||
In order to use the `Sci-py` gaussian window we need to provide the parameters | ||
M and std. The parameter M corresponds to 2 in our example. | ||
We pass the second parameter std as a parameter of the following method: | ||
|
||
>>> ser.rolling(2, win_type='gaussian').mean(std=3) | ||
0 NaN | ||
1 0.5 | ||
2 3.0 | ||
3 3.5 | ||
4 5.0 | ||
dtype: float64 | ||
""" | ||
).replace("\n", "", 1), | ||
window_method="rolling", | ||
aggregation_description="weighted window mean", | ||
agg_method="mean", | ||
|
@@ -1320,7 +1369,31 @@ def mean(self, numeric_only: bool = False, **kwargs): | |
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([0, 1, 5, 2, 8]) | ||
|
||
In order to get an instance of pandas.core.window.rolling.Window we need | ||
to pass the parameter `win_type`. | ||
|
||
>>> type(ser.rolling(2, win_type='gaussian')) | ||
<class 'pandas.core.window.rolling.Window'> | ||
|
||
In order to use the `Sci-py` gaussian window we need to provide the parameters | ||
M and std. The parameter M corresponds to 2 in our example. | ||
We pass the second parameter std as a parameter of the following method: | ||
|
||
>>> ser.rolling(2, win_type='gaussian').var(std=3) | ||
0 NaN | ||
1 0.5 | ||
2 8.0 | ||
3 4.5 | ||
4 18.0 | ||
dtype: float64 | ||
""" | ||
).replace("\n", "", 1), | ||
window_method="rolling", | ||
aggregation_description="weighted window variance", | ||
agg_method="var", | ||
|
@@ -1338,7 +1411,31 @@ def var(self, ddof: int = 1, numeric_only: bool = False, **kwargs): | |
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([0, 1, 5, 2, 8]) | ||
|
||
In order to get an instance of pandas.core.window.rolling.Window we need | ||
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. does this link work? I think you may need to write :class: 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 |
||
to pass the parameter `win_type`. | ||
|
||
>>> type(ser.rolling(2, win_type='gaussian')) | ||
<class 'pandas.core.window.rolling.Window'> | ||
|
||
In order to use the `Sci-py` gaussian window we need to provide the parameters | ||
M and std. The parameter M corresponds to 2 in our example. | ||
We pass the second parameter std as a parameter of the following method: | ||
|
||
>>> ser.rolling(2, win_type='gaussian').std(std=3) | ||
0 NaN | ||
1 0.707107 | ||
2 2.828427 | ||
3 2.121320 | ||
4 4.242641 | ||
dtype: float64 | ||
""" | ||
).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. same comment as in the other 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. Ouch... I just saw this one! - I'll change it. |
||
window_method="rolling", | ||
aggregation_description="weighted window standard deviation", | ||
agg_method="std", | ||
|
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 think we can just write "SciPy"
also, gaussian => Gaussian
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