-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Allow typecode of 'e' to be passed to select_dtypes #11991
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
hmm why does his raise a TypeError? float16 is platform specific I think ? |
np.e is defined and it's a float :)
|
@@ -1482,10 +1482,11 @@ def _get_dtype_from_object(dtype): | |||
|
|||
try: | |||
return _get_dtype_from_object(getattr(np,dtype)) |
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.
hmm, I think this should be changed to:
np.dtype(dtype)
as that wontt have the issue, and catch TypeError
and not AttributeError
and is more correct
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.
On Thu, Jan 7, 2016, 1:09 PM Jeff Reback [email protected] wrote:
In pandas/core/common.py
#11991 (comment):@@ -1482,10 +1482,11 @@ def _get_dtype_from_object(dtype):
try: return _get_dtype_from_object(getattr(np,dtype))
hmm, I think this should be changed to:
np.dtype(dtype) as that wontt have the issue, and catch TypeError and not
AttributeErrorand is more correct
I tried that. There was a test for dtype='integer' that fails. If you think
it shouldn't be supported, I would agree. But I don't feel strongly about
it.
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.
how about (just trying to be somewhat generic)
try:
np.typeDict.get(dtype) or np.typecodes[dtype]``
except KeyError:
pass
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 would still fail the dtype='integer'
case, and I'm not sure the latter would work at all without more processing. It's the use case I'm solving with the test.
What case are you trying to solve with the above?
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.
all right, this ok I guess
add a whatsnew note as well |
@@ -112,6 +112,7 @@ Other enhancements | |||
values it contains (:issue:`11597`) | |||
- ``Series`` gained an ``is_unique`` attribute (:issue:`11946`) | |||
- ``DataFrame.quantile`` and ``Series.quantile`` now accept ``interpolation`` keyword (:issue:`10174`). | |||
- ``DataFrame.select_dtypes`` now allows the np.float16 typecode (:issue:`11990`) |
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.
double backticks around np.float16
minor change, pls squash, ping when green. |
can you update |
TST: Failing test for numpy typecode select BUG: Let numpy typecodes pass through. DOC: Document bug fix STY: Formatting
Green. |
I find your patch fine. But isn't this odd?
|
merged via 138b8ba |
That would be my expectation since |
Actually, it might be nice to just accept the all typecode aliases too. On Tue, Jan 12, 2016, 5:48 PM Jeff Reback [email protected] wrote:
|
would accept PR for that addition |
Closes #11990.