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

Resample with period='AS'/'A' does not work on localized indexes for multiple methods in "how" #6397

Closed
jphme opened this issue Feb 18, 2014 · 3 comments · Fixed by #6477
Closed
Assignees
Labels
Bug Datetime Datetime data dtype Resample resample method Timezones Timezone data dtype
Milestone

Comments

@jphme
Copy link

jphme commented Feb 18, 2014

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

how=np.mean

or just use 1 column in the dict

how={'first':np.mean}

it works too.

python 2.7.5
pandas 0.13.1

EDIT: Changed to include full example

@jreback
Copy link
Contributor

jreback commented Feb 18, 2014

can you provide the starting dataframe (code to recreate, doesn't have to be long), that reproduces this problem?

@jphme
Copy link
Author

jphme commented Feb 18, 2014

Changed the example so you can recreate it now!

If that means anything: with pandas 0.12 i get a TypeError, with pandas 0.13.1 it changed to ValueError (but the issue is the same).

@jreback jreback added this to the 0.14.0 milestone Feb 18, 2014
@jreback jreback self-assigned this Feb 18, 2014
@jreback
Copy link
Contributor

jreback commented Feb 18, 2014

gr8...thanks...will get to it for 0.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype Resample resample method Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants