Skip to content
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

BUG: replace should handle Bool blocks correctly #6332

Closed
jreback opened this issue Feb 12, 2014 · 20 comments · Fixed by #6339
Closed

BUG: replace should handle Bool blocks correctly #6332

jreback opened this issue Feb 12, 2014 · 20 comments · Fixed by #6339
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Feb 12, 2014

http://stackoverflow.com/questions/21733802/pandas-series-replace-on-boolean-series

by definition they don't have missing values

@jreback jreback added this to the 0.14.0 milestone Feb 12, 2014
@TomAugspurger
Copy link
Contributor

Are we ever going to get an integer or bool NaN? I'm haven't followed any developments in this.

@jreback
Copy link
Contributor Author

jreback commented Feb 12, 2014

its not that difficult if you use a NaT like value (e.g. np.iinfo(np.int64).min)) (which would have to be set for each of the dtypes. (and bool would have to be represented by say np.uint8 or something.

Then of course you would have to go thru lots of routines and deal with the special handling (that is implicity in that you know that int64 if its a dtype of int64 cannot right now have a missing value).

so would have to have someone with lots of time to do this!

up for it @TomAugspurger ?

@TomAugspurger
Copy link
Contributor

I wasn't volunteering :) Maybe someday. I was just asking because I was thinking about skipping int and bool blocks in the interpolation routines.

@jreback
Copy link
Contributor Author

jreback commented Feb 12, 2014

@TomAugspurger yep....that's makes sense for interpolate for sure

@jreback
Copy link
Contributor Author

jreback commented Feb 12, 2014

technically replace actually shouldn't ignore on Bool blocks but only replace if the values are True/False

@jreback
Copy link
Contributor Author

jreback commented Feb 12, 2014

@cpcloud want 2 take this?

@cpcloud
Copy link
Member

cpcloud commented Feb 12, 2014

Happy to fix the bool issue here. Not going to implement inans or bool nans

@jreback
Copy link
Contributor Author

jreback commented Feb 12, 2014

hah!

that's what I meant :)

FYI also need to test case where u are replacing say True with a value (which prob will switch dtype)

@cpcloud
Copy link
Member

cpcloud commented Feb 13, 2014

weird just those no-op cases fail ... the other cases work

@cpcloud
Copy link
Member

cpcloud commented Feb 13, 2014

into the cave of replace we go 😄

@cpcloud
Copy link
Member

cpcloud commented Feb 13, 2014

@jreback Turns out it's not an issue with blocks or replace per se. In com.mask_missing string values to be masked are coerced to bool. If the replacement strings are non-empty then the mask is the original bool array. That's then passed to putmask eventually which of course replaces those True values with the string

@jreback
Copy link
Contributor Author

jreback commented Feb 13, 2014

@cpcloud
Copy link
Member

cpcloud commented Feb 13, 2014

If you can wait until 10:00a I can fix it :) Otherwise feel free to revert.

@cpcloud
Copy link
Member

cpcloud commented Feb 13, 2014

I thought this passed earlier ... I'm not going crazy am I?

@jreback
Copy link
Contributor Author

jreback commented Feb 13, 2014

np...take time....maybe somehow random?

@jreback
Copy link
Contributor Author

jreback commented Feb 13, 2014

hmm...went away in latest master.....random maybe?

@cpcloud
Copy link
Member

cpcloud commented Feb 13, 2014

yeah ... i actually can't really work on this ATM .... tried to do it on windows but taking too much just to get the friggin thing setup

@cpcloud
Copy link
Member

cpcloud commented Feb 13, 2014

can investigate tonight

@jreback
Copy link
Contributor Author

jreback commented Feb 13, 2014

hahha...ok...np...lmk

@jreback
Copy link
Contributor Author

jreback commented Feb 13, 2014

popped up again.....weird...

https://travis-ci.org/pydata/pandas/jobs/18842827

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants