REGR: .clip and datetime w/timezone · Issue #11838 · pandas-dev/pandas (original) (raw)

@ciamac

There seem to be some incompatibilities with timezones and timestamps in 0.17.1.

For example, here I'm trying to clip a timezone-aware column with a timezone-aware timestamp:

In [224]: import pandas

In [225]: u = pandas.Timestamp('2015-12-01 09:30:30', tz='US/Eastern')

In [226]: print u
2015-12-01 09:30:30-05:00

In [227]: df = pandas.DataFrame({ 'foo' : [ pandas.Timestamp('2015-12-01 09:30:00', tz='US/Eastern'), pandas.Timestamp('2015-12-01 09:31:00', tz='US/Eastern') ] })

In [228]: print df
                        foo
0 2015-12-01 09:30:00-05:00
1 2015-12-01 09:31:00-05:00

In [229]: df['foo'].clip(upper=u)

TypeError: Could not compare [Timestamp('2015-12-01 09:30:30-0500', tz='US/Eastern')] with block values

This code used to work on 0.16.2.