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: TDI / TDI should work #22631

Closed
jreback opened this issue Sep 8, 2018 · 3 comments · Fixed by #23829
Closed

BUG: TDI / TDI should work #22631

jreback opened this issue Sep 8, 2018 · 3 comments · Fixed by #23829
Labels
Numeric Operations Arithmetic, Comparison, and Logical operations Timedelta Timedelta data type
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Sep 8, 2018

In [1]: pd.__version__
Out[1]: '0.20.3'

In [2]: i = pd.timedelta_range('1 day', periods=3)

In [3]: i / i
TypeError: cannot evaluate a numeric op with a non-numeric dtype

master

In [1]: pd.__version__
Out[1]: '0.24.0.dev0+550.g70c9003c9'

In [2]: i = pd.timedelta_range('1 day', periods=3)

In [3]: i / i
TypeError: unsupported operand type(s) for /: 'TimedeltaIndex' and 'TimedeltaIndex'

In [4]: i / 2
Out[4]: TimedeltaIndex(['0 days 12:00:00', '1 days 00:00:00', '1 days 12:00:00'], dtype='timedelta64[ns]', freq='12H')

In [5]: i / pd.Timedelta('1 day')
Out[5]: Float64Index([1.0, 2.0, 3.0], dtype='float64')

# conversion then op works
In [8]: i.astype('i8') / i.astype('i8')
Out[8]: Float64Index([1.0, 1.0, 1.0], dtype='float64')


@jreback jreback added Numeric Operations Arithmetic, Comparison, and Logical operations Timedelta Timedelta data type labels Sep 8, 2018
@jreback jreback added this to the 0.24.0 milestone Sep 8, 2018
@jreback
Copy link
Contributor Author

jreback commented Sep 8, 2018

cc @jbrockmendel

I really thought this DID work in 0.20.3, though my example is not reproducible ATM.

of course this works for a scalar TD or numeric on the rhs.

Is there a reason we didn't allow TDI / TDI though?

@jreback
Copy link
Contributor Author

jreback commented Sep 8, 2018

cc @joshuastorck

@jbrockmendel
Copy link
Member

Is there a reason we didn't allow TDI / TDI though?

Not that I can think of. In trying this myself found #22632.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Numeric Operations Arithmetic, Comparison, and Logical operations Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants