-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Update to docstring of DataFrame(dtype) (#14764) #16487
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
Conversation
Merging from master
Merge from pandas-dev
Codecov Report
@@ Coverage Diff @@
## master #16487 +/- ##
=======================================
Coverage 90.4% 90.4%
=======================================
Files 161 161
Lines 51033 51033
=======================================
Hits 46136 46136
Misses 4897 4897
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #16487 +/- ##
==========================================
- Coverage 90.79% 90.75% -0.05%
==========================================
Files 161 161
Lines 51063 51071 +8
==========================================
- Hits 46365 46348 -17
- Misses 4698 4723 +25
Continue to review full report at Codecov.
|
@@ -241,17 +241,52 @@ class DataFrame(NDFrame): | |||
Column labels to use for resulting frame. Will default to | |||
np.arange(n) if no column labels are provided | |||
dtype : dtype, default None | |||
Data type to force, otherwise infer | |||
Data type to force. Only a single dtype is allowed. If None, infer |
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.
this is not right. you can pass a dict of dtypes.
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.
Oh interesting. How? This does not work for me:
d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d, dtype={'col1': np.int64, 'col2': np.int64})
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 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.
#13375 implemented his for astype
hasn't been implemented for construction
pandas/core/frame.py
Outdated
... columns=['a', 'b', 'c', 'd', 'e']) | ||
>>> df2 | ||
a b c d e |
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.
these are not lined up, something odd going on.
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 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 line up on the decimals.
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.
sure I'll just change the example to something easier with integers to take up less space anyway.
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.
Looks good! (I did a small cosmetic edit, see latest commit)
@VincentLa Thanks! |
…as-dev#16487) * Adding some more documentation on dataframe with regards to dtype * Making example for creating dataframe from np matrix easier
…as-dev#16487) * Adding some more documentation on dataframe with regards to dtype * Making example for creating dataframe from np matrix easier
git diff upstream/master --name-only -- '*.py' | flake8 --diff