-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
DOC: update the dtypes/ftypes docstring (Seoul) #20100
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
8bce675
05306db
1b34fcd
14cc494
14b754f
8058931
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4275,7 +4275,29 @@ def get_ftype_counts(self): | |
|
|
||
| @property | ||
| def dtypes(self): | ||
| """Return the dtypes in this object.""" | ||
| """ | ||
| Return the dtypes in this object. | ||
|
|
||
|
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 you please add a Returns section as specified in the guide? 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 'See Also' section to contemplate common dtypes. |
||
| Notes | ||
|
||
| ----- | ||
| It returns a Series with the data type of each column. | ||
|
||
| If object contains data multiple dtypes in a single column, | ||
| dtypes will be chosen to accommodate all of the data types. | ||
| ``object`` is the most general. | ||
|
||
|
|
||
|
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 believe in a See Also section |
||
| Examples | ||
| -------- | ||
| >>> df = pd.DataFrame({'f': pd.np.random.rand(3), | ||
|
||
| ... 'i': 1, | ||
| ... 'd': pd.Timestamp('20180310'), | ||
| ... 'o': 'foo'}) | ||
|
||
| >>> df.dtypes | ||
| f float64 | ||
| i int64 | ||
| d datetime64[ns] | ||
| o object | ||
| dtype: object | ||
| """ | ||
| from pandas import Series | ||
| return Series(self._data.get_dtypes(), index=self._info_axis, | ||
| dtype=np.object_) | ||
|
|
@@ -4285,6 +4307,31 @@ def ftypes(self): | |
| """ | ||
|
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 would better organized it there was pull request for dtypes and another pull request for ftypes. |
||
| Return the ftypes (indication of sparse/dense and dtype) | ||
|
||
| in this object. | ||
|
|
||
|
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 return section. |
||
| Notes | ||
| ----- | ||
| Sparse data should have the same dtypes as its dense representation | ||
|
||
|
|
||
| See Also | ||
|
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' should go before notes. |
||
| -------- | ||
| dtypes, SparseDataFrame | ||
|
||
|
|
||
| Examples | ||
| -------- | ||
| >>> arr = pd.np.random.randn(100, 4) | ||
|
||
| >>> arr[arr < .8] = pd.np.nan | ||
| >>> pd.DataFrame(arr).ftypes | ||
| 0 float64:dense | ||
| 1 float64:dense | ||
| 2 float64:dense | ||
| 3 float64:dense | ||
| dtype: object | ||
| >>> pd.SparseDataFrame(arr).ftypes | ||
|
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. Maybe a blank line before this to break things up a bit. |
||
| 0 float64:sparse | ||
| 1 float64:sparse | ||
| 2 float64:sparse | ||
| 3 float64:sparse | ||
| dtype: object | ||
| """ | ||
| from pandas import Series | ||
| return Series(self._data.get_ftypes(), index=self._info_axis, | ||
|
|
||
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.
Explain in more depth to a novice user that this is used to get the dtypes per column of the DataFrame.