Skip to content

DOC: Update Kurt Docstr #20044

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 9 commits into from
Mar 9, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions pandas/core/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,9 @@ def skew(self, **kwargs):

Returns
-------
Series or DataFrame (matches input)
Like-indexed object containing the result of function application
Series or DataFrame
Returned object type is dictated by the caller of the %(name)s
Copy link
Member

Choose a reason for hiding this comment

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

As a non-native speaker, I found your original "determined" better than "dictated" (but maybe not more correct :-)). Or simpler "Returned object is of the same type as the caller ..." ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well I was trying to be as literal as possible so I didn't want to say caller, since that's technically either the Rolling or Expanding object. I'll revert to determined - not that semantically different

calculation
Copy link
Member

Choose a reason for hiding this comment

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

align with the "Returned .." from above


See Also
--------
Expand All @@ -932,19 +933,20 @@ def skew(self, **kwargs):
four matching the equivalent function call using `scipy.stats`.

>>> arr = [1, 2, 3, 4, 999]
>>> fmt = "{0:.6f}" # limit the printed precision to 6 digits
>>> import scipy.stats
>>> print("{0:.6f}".format(scipy.stats.kurtosis(arr[:-1], bias=False)))
>>> print(fmt.format(scipy.stats.kurtosis(arr[:-1], bias=False)))
-1.200000
>>> print("{0:.6f}".format(scipy.stats.kurtosis(arr[1:], bias=False)))
>>> print(fmt.format(scipy.stats.kurtosis(arr[1:], bias=False)))
3.999946
>>> df = pd.DataFrame(arr)
>>> df.rolling(4).kurt()
0
0 NaN
1 NaN
2 NaN
3 -1.200000
4 3.999946
>>> ser = pd.Series(arr)
Copy link
Member

Choose a reason for hiding this comment

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

let's use s by default (following the guide)

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm OK I didn't see that. I would actually prefer ser to s but I'll bring that up as a separate discussion point with the docs. Will change for now

>>> ser.rolling(4).kurt()
0 NaN
1 NaN
2 NaN
3 -1.200000
4 3.999946
dtype: float64
""")

def kurt(self, **kwargs):
Expand Down