Skip to content

convert_objects incorrectly converting bools to nans #7126

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

Closed
cpcloud opened this issue May 14, 2014 · 2 comments · Fixed by #7416
Closed

convert_objects incorrectly converting bools to nans #7126

cpcloud opened this issue May 14, 2014 · 2 comments · Fixed by #7416
Assignees
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Numeric Operations Arithmetic, Comparison, and Logical operations
Milestone

Comments

@cpcloud
Copy link
Member

cpcloud commented May 14, 2014

SO xref: http://stackoverflow.com/q/23658092/564538

In [45]: paste
>>> s1 = Series([1, True, 3, 5], index=['a', 'b', 'c', 'e'])

## -- End pasted text --

In [46]: s1
Out[46]:
a       1
b    True
c       3
e       5
dtype: object

In [47]: s1.convert_objects(convert_numeric=True)
Out[47]:
a     1
b   NaN
c     3
e     5
dtype: float64
@cpcloud cpcloud added this to the 0.14.1 milestone May 14, 2014
@jreback
Copy link
Contributor

jreback commented May 14, 2014

you mean you think the bools should be coerced to integers? (e.g. 1 in this case), as opposed to eliminated any non-integer/float values; makes sense

@cpcloud
Copy link
Member Author

cpcloud commented May 14, 2014

yep they should be cast to the type of the surrounding elements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants