-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: regression in Timedelta.__rfloordiv__ with integer data #19761
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
Comments
I think this was introduced (on purpose, tests were added) in #18961. |
So we need to make a decision on this one. Options:
Given that the method is not very intuitive, I would be in favor of option 3 if we have a good alternative. |
I think 3.
…On Thu, Mar 29, 2018 at 4:05 AM, Joris Van den Bossche < ***@***.***> wrote:
So we need to make a decision on this one. Options:
1.
Keep the behaviour on master (= keep limitation of behaviour of
Timedelta.__rfloordiv__ ) and update the docs with an alternative
solution. What would this alternative be?
2.
Undo the regression and re-enable the previous behaviour of
Timedelta.__rfloordiv__
3.
Re-enable the previous behaviour of Timedelta.__rfloordiv__ but with a
deprecation warning it will be removed in the future. Provide alternative
solution in the warning and docs.
cc @jreback <https://github.com/jreback> @TomAugspurger
<https://github.com/TomAugspurger>
Given that the method is not very intuitive, I would be in favor of option
3 *if* we have a good alternative.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19761 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIsGUBITOCGfju8lKqvuG1KGNDI5wks5tjKP2gaJpZM4SKMmk>
.
|
For 1, the alternative solution would be to also use the integer value for the Timedelta
It's also a bit weird to have |
so either use
is a reasonable soln (This is more natural as you are dividing a TDI / Timedelta which is a bit more clear) |
Are we comfortable with advertising the use of In that case, the |
you can use .view if u want it’s ok here |
i know we have .asi8 which is slightly non standard |
I have a fix for this using |
We'll still need the warning for backwards compat, but we'll recommend |
Closes pandas-dev#19761. ```python In [2]: pd.DatetimeIndex(['1931', '1970', '2017']).view('i8') // pd.Timedelta(1, unit='s') pandas-dev/bin/ipython:1: FutureWarning: Floor division between integer array and Timedelta is deprecated. Use 'array // timedelta.value' instead. Out[2]: array([-1230768000, 0, 1483228800]) ```
Closes pandas-dev#19761. ```python In [2]: pd.DatetimeIndex(['1931', '1970', '2017']).view('i8') // pd.Timedelta(1, unit='s') pandas-dev/bin/ipython:1: FutureWarning: Floor division between integer array and Timedelta is deprecated. Use 'array // timedelta.value' instead. Out[2]: array([-1230768000, 0, 1483228800]) ```
I was thinking, would actually allowing a `Timestamp(..) / Timedelta(..) = number" operation be another option? |
From a failing example in the docs (http://pandas-docs.github.io/pandas-docs-travis/timeseries.html#from-timestamps-to-epoch):
This was working correctly in 0.22, and is mentioned in the docs explicitly as a way to get unix epoch data.
The previously working example (http://pandas.pydata.org/pandas-docs/stable/timeseries.html#from-timestamps-to-epoch) looks like:
cc @jbrockmendel
The text was updated successfully, but these errors were encountered: