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: Timedelta.__floordiv__ - need historical context #18846

jbrockmendel opened this Issue Dec 19, 2017 · 2 comments


None yet
2 participants

jbrockmendel commented Dec 19, 2017

>>> pd.Timedelta(days=3, hours=4) // np.datetime64('NaT')

Timedelta.__floordiv__ and __rfloordiv__ begin with:

        if hasattr(other, 'dtype'):
            # work with i8
            other = other.astype('m8[ns]').astype('i8')

I think this is a historical artifact from early numpy versions, because in core.ops there is a comment:

            # time delta division -> unit less
            # integer gets converted to timedelta in np < 1.6
            if ((self.is_timedelta_lhs and self.is_timedelta_rhs) and
                    not self.is_integer_rhs and not self.is_integer_lhs and
           in ('__div__', '__truediv__')):

Before I try to fix Timedelta.__floordiv__ can someone knowledgeable weight in on why all dtypes are being converted to i8?


This comment has been minimized.


jreback commented Dec 20, 2017

yes I think this is ok (to fix), maybe some prior version . numpy issues we were working around

@jreback jreback modified the milestones: Next Major Release, 0.22.0 Dec 20, 2017

@jbrockmendel jbrockmendel referenced this issue Dec 27, 2017


Fix Timedelta.__floordiv__, __rfloordiv__ #18961

4 of 4 tasks complete

This comment has been minimized.


jbrockmendel commented Dec 31, 2017

This issue goes with #18961, not 18831.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment