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

Problem with Series.clip with Timestamp threshold #3996

Closed
miketkelly opened this issue Jun 22, 2013 · 1 comment · Fixed by #3998
Closed

Problem with Series.clip with Timestamp threshold #3996

miketkelly opened this issue Jun 22, 2013 · 1 comment · Fixed by #3998

Comments

@miketkelly
Copy link

>>> 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.

@jreback
Copy link
Contributor

jreback commented Jun 22, 2013

yes....Serise.where knows how to deal with datetime64[ns] and NaT so that would be a good change

if you want to do a PR, pls add a test for this (and see that existing tests pass)

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants