-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC: update the axes, shape, dim and size property docstring (Seoul) #20101
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 all commits
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 |
---|---|---|
|
@@ -457,12 +457,49 @@ def axes(self): | |
|
||
@property | ||
def ndim(self): | ||
"""Number of axes / array dimensions""" | ||
""" | ||
Return an int representing the number of axes / array dimensions. | ||
|
||
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 it would be fine to add here a sentence saying that this is always 1 for Series and 2 for DataFrame 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. Done. |
||
Return 1 if Series. Otherwise return 2 if DataFrame. | ||
|
||
See Also | ||
-------- | ||
ndarray.ndim | ||
|
||
Examples | ||
-------- | ||
>>> s = pd.Series({'a': 1, 'b': 2, 'c': 3}) | ||
>>> s.ndim | ||
1 | ||
|
||
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]}) | ||
>>> df.ndim | ||
2 | ||
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. See Also to ndarray.ndim 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. Done. |
||
""" | ||
return self._data.ndim | ||
|
||
@property | ||
def size(self): | ||
"""number of elements in the NDFrame""" | ||
""" | ||
Return an int representing the number of elements in this object. | ||
|
||
Return the number of rows if Series. Otherwise return the number of | ||
rows times number of columns if DataFrame. | ||
|
||
See Also | ||
-------- | ||
ndarray.size | ||
|
||
Examples | ||
-------- | ||
>>> s = pd.Series({'a': 1, 'b': 2, 'c': 3}) | ||
>>> s.size | ||
3 | ||
|
||
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]}) | ||
>>> df.size | ||
4 | ||
""" | ||
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. See Also to ndarray.size 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. Done. |
||
return np.prod(self.shape) | ||
|
||
@property | ||
|
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.
can you add a See Also to ndarray.shape
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.