Skip to content

Problem with Series.clip with Timestamp threshold #3996

@miketkelly

Description

@miketkelly
>>> import pandas as pd
>>> s = pd.Series(pd.date_range('2013-05-01', '2013-05-03'))
>>> s
0   2013-05-01 00:00:00
1   2013-05-02 00:00:00
2   2013-05-03 00:00:00
dtype: datetime64[ns]

>>> s.clip_lower(s[1])
0    2013-05-02 00:00:00
1    1367452800000000000
2    1367539200000000000
dtype: object

>>> s.clip_lower(s[1].value)
0   2013-05-02 00:00:00
1   2013-05-02 00:00:00
2   2013-05-03 00:00:00
dtype: datetime64[ns]

>>> print pd.__version__
0.11.1.dev-f1a3226

Any reason not to implement clip_lower and clip_upper with Series.where rather than np.where? It solves this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions