Skip to content

BUG: setting td64 value into numeric Series incorrectly casting to int #39488

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

Merged
merged 9 commits into from
Feb 3, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

We fixed this a few days ago for some of the setting-methods, but there were a few we missed. Re-using the TestSetitemEquivalents pattern is much more thorough.

We'll be able to de-duplicate the test class following #39477

@jreback jreback added Indexing Related to indexing on series/frames, not to indexes themselves Timedelta Timedelta data type labels Feb 2, 2021
@jreback
Copy link
Contributor

jreback commented Feb 2, 2021

We'll be able to de-duplicate the test class following #39477

this is deduplicated?

@jbrockmendel
Copy link
Member Author

this is deduplicated?

haven't updated to de-dup yet, turns out to be a little non-trivial bc this makes some view-or-not assertions the other doesnt

@jreback jreback added this to the 1.3 milestone Feb 2, 2021
values = np.where(cond, values, other)
if isinstance(other, np.timedelta64) and self.dtype == object:
# https://github.com/numpy/numpy/issues/12550
# timedelta64 will incorrectly cast to int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too bad you cannot use np.where then cast back the integers if necessary

@jreback jreback merged commit facdb89 into pandas-dev:master Feb 3, 2021
@jreback
Copy link
Contributor

jreback commented Feb 3, 2021

prob should add a whatsnew for this change

@jbrockmendel jbrockmendel deleted the tst-indexing-2 branch February 3, 2021 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants