-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: update the pd.DataFrame.memory_usage/empty docstring(Seoul) #20102
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
3dff081
fc5b498
b033dc6
bb7f341
1585a0e
d4cc71d
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 |
---|---|---|
|
@@ -1943,7 +1943,11 @@ def _sizeof_fmt(num, size_qualifier): | |
_put_lines(buf, lines) | ||
|
||
def memory_usage(self, index=True, deep=False): | ||
"""Memory usage of DataFrame columns. | ||
""" | ||
Memory usage of DataFrame columns. | ||
|
||
Memory usage of DataFrame is accessing pandas.DataFrame.info method. | ||
A configuration option, `display.memory_usage` (see Parameters) | ||
|
||
Parameters | ||
---------- | ||
|
@@ -1953,7 +1957,7 @@ def memory_usage(self, index=True, deep=False): | |
the first index of the Series is `Index`. | ||
deep : bool | ||
Introspect the data deeply, interrogate | ||
`object` dtypes for system-level memory consumption | ||
`object` dtypes for system-level memory consumption. | ||
|
||
Returns | ||
------- | ||
|
@@ -1969,6 +1973,38 @@ def memory_usage(self, index=True, deep=False): | |
See Also | ||
-------- | ||
numpy.ndarray.nbytes | ||
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. add Series.memory_usage |
||
|
||
Examples | ||
-------- | ||
>>> dtypes = ['int64', 'float64', 'complex128', 'object', 'bool'] | ||
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. add a categorical type here as well |
||
>>> data = dict([(t, np.random.randint(100, size=5000).astype(t)) | ||
... for t in dtypes]) | ||
>>> df = pd.DataFrame(data) | ||
>>> df.memory_usage() | ||
Index 80 | ||
int64 40000 | ||
float64 40000 | ||
complex128 80000 | ||
object 40000 | ||
bool 5000 | ||
dtype: int64 | ||
>>> df.memory_usage(index=False) | ||
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'm not certain the two latter examples (with |
||
int64 40000 | ||
float64 40000 | ||
complex128 80000 | ||
object 40000 | ||
bool 5000 | ||
dtype: int64 | ||
>>> df.memory_usage(index=True) | ||
Index 80 | ||
int64 40000 | ||
float64 40000 | ||
complex128 80000 | ||
object 40000 | ||
bool 5000 | ||
dtype: int64 | ||
>>> df.memory_usage(index=True).sum() | ||
205080 | ||
""" | ||
result = Series([c.memory_usage(index=False, deep=deep) | ||
for col, c in self.iteritems()], index=self.columns) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1436,12 +1436,20 @@ def __contains__(self, key): | |
|
||
@property | ||
def empty(self): | ||
"""True if NDFrame is entirely empty [no items], meaning any of the | ||
""" | ||
True if DataFrame is empty. | ||
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. It should be Edit: nevermind, the official docstring example doesn't seem to do that. |
||
|
||
True if DataFrame is entirely empty [no items], meaning any of the | ||
axes are of length 0. | ||
|
||
Returns | ||
------- | ||
empty : boolean | ||
if DataFrame is empty, return true, if not return false. | ||
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. True, False |
||
|
||
Notes | ||
----- | ||
If NDFrame contains only NaNs, it is still not considered empty. See | ||
If DataFrame contains only NaNs, it is still not considered empty. See | ||
the example below. | ||
|
||
Examples | ||
|
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.
There seems to be missing something in this sentence.
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.
Fixed.