Skip to content

scalar subtraction doesn't work on Series with dtype datetime64 #2945

Closed
@changhiskhan

Description

@changhiskhan

In [34]: df
Out[34]:
0 1 time
0 -0.602181 -0.657444 2009-07-01 00:00:00
1 -2.102987 -0.486064 2009-07-02 00:00:00
2 0.819956 -0.800478 2009-07-03 00:00:00
3 1.118629 -0.008019 2009-07-04 00:00:00
4 0.404452 0.606187 2009-07-05 00:00:00

In [35]: df.time.dtype
Out[35]: dtype('datetime64[ns]')

In [36]: image_time
Out[36]: datetime.datetime(2009, 7, 28, 13, 39, 2)

In [37]: df.time - image_time

ValueError Traceback (most recent call last)
in ()
----> 1 df.time - image_time

/Users/changshe/code/pandas/pandas/core/series.pyc in wrapper(self, other)
94 dtype = 'timedelta64[ns]'
95 else:
---> 96 raise ValueError("cannot operate on a series with out a rhs of a series/ndarray of type datetime64[ns] or a timedelta")
97
98 lvalues = lvalues.view('i8')

ValueError: cannot operate on a series with out a rhs of a series/ndarray of type datetime64[ns] or a timedelta

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions