A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/6397 below:

Resample with period='AS'/'A' does not work on localized indexes for multiple methods in "how" · Issue #6397 · pandas-dev/pandas · GitHub

I encountered a similar issue to (closed) #3592 .

When trying to resample a dataframe with a localized Datetime Index using the how method:

rng = pd.date_range('1/1/2011', periods=20000, freq='H')
rng = rng.tz_localize('EST')
ts = pd.DataFrame(index=rng)
ts['first']=np.random.randn(len(rng))
ts['second']=np.cumsum(np.random.randn(len(rng)))
ts2=ts.resample('A', how={'first':np.sum, 'second':np.mean})

*File "tslib.pyx", line 465, in pandas.tslib._Timestamp.__richcmp__ (pandas\tslib.c:9313)
*TypeError: can't compare offset-naive and offset-aware datetimes

For other (,lower) frequencies like "M" the same code works fine and if I just use

or just use 1 column in the dict

it works too.

python 2.7.5
pandas 0.13.1

EDIT: Changed to include full example


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4