Resample with multiple columns?

1,226 views
Skip to first unread message

dartdog

unread,
Jul 21, 2013, 3:14:19 PM7/21/13
to pyd...@googlegroups.com
Using reasample and it very cool and useful.
Can I resample data with multiple columns and aggregations? for instance:
LIST_PRICESOLD_PRICE
MOYRLD
1999-01-01314900NaN
1999-01-01369000369000
1999-01-01368000360000
1999-01-01259900259900
1999-01-01239900239900
I'd like to get both the means and counts by quarter. From the docs I see I can get the mean or count for one column eg: df3=df2.resample('Q') give the mean if I have a DF with one column, but I don't see how to do :
both(count and mean) and multiple columns?

Jeff

unread,
Jul 22, 2013, 3:08:19 PM7/22/13
to pyd...@googlegroups.com
NotImplemented at this time

Its not that hard, but would need some test cases and a bit additional code

esentially you take a frame and generate a panel-like (or a multi-level indexed panel)

as a work-around as you do what you suggest: iterate over the functions and produce multiple frames

which then could be concatted together (this is pretty straightforward)

and you could actually implement it like this

If you have further interest in helping do a PR on this, pls indicate on the open issue...
and can go from there

thanks,

Jeff

https://github.com/pydata/pandas/issues/3551

dartdog

unread,
Jul 22, 2013, 3:56:14 PM7/22/13
to pyd...@googlegroups.com
Thanks for the reply, was trying to figure it out, Wish I could help with implementing,
I'm still struggling to use the great features others have implemented. 
The open issue gives some good guidance.
Tom

Jeff Reback

unread,
Jul 22, 2013, 4:18:05 PM7/22/13
to pyd...@googlegroups.com
np....let me know if you need more help

--
You received this message because you are subscribed to the Google Groups "PyData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pydata+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages