datetime - python how to sum together all values within a time interval in datetime64? -
i have pandas dataframe looks like:
payment_method dcash_t3m dcash_t3m_3d paypal unknown combined day_name 2013-08-27 0 0 0 1 1 2013-08-28 0 0 0 4 4 2013-08-29 0 0 0 17 17 2013-08-30 0 0 0 4 4 2013-09-02 0 0 0 3 3 2013-09-03 0 0 0 1 1 2013-09-04 0 0 0 3 3 2013-09-05 0 0 0 1 1 2013-09-06 0 0 0 5 5 2013-09-09 0 0 0 2 2 2013-09-10 0 0 0 5 5 2013-09-11 0 0 0 18 18 2013-09-12 0 0 0 6 6 2013-09-13 0 0 0 13 13 2013-09-16 0 0 0 19 19 .....
i sum days in same week have new row each week sum. need month
thanks.
this df.resample
about.
as long have proper time-series index.
try df.resample('w', how=sum)
weekly, df.resample('m', how=sum)
monthly.
Comments
Post a Comment