Skip to content

BUG: regression in Timedelta.__rfloordiv__ with integer data #19761

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

From a failing example in the docs (http://pandas-docs.github.io/pandas-docs-travis/timeseries.html#from-timestamps-to-epoch):

In [46]: stamps = pd.date_range('2012-10-08 18:15:05', periods=4, freq='D')

In [47]: stamps.view('int64') // pd.Timedelta(1, unit='s')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-47-9893b9bae6cf> in <module>()
----> 1 stamps.view('int64') // pd.Timedelta(1, unit='s')

/home/joris/scipy/pandas/pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.Timedelta.__rfloordiv__()

TypeError: Invalid dtype int64 for __floordiv__

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:

In [42]: stamps.view('int64') // pd.Timedelta(1, unit='s')
Out[42]: array([1349720105, 1349806505, 1349892905, 1349979305])

cc @jbrockmendel

Metadata

Metadata

Assignees

No one assigned

    Labels

    BlockerBlocking issue or pull request for an upcoming releaseRegressionFunctionality that used to work in a prior pandas versionTimedeltaTimedelta data type

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions