python - Group by business day of month -
data generated on business days.
df['day_of_month'] = df.index.day date........................................ day_of_month 2014-11-26 1049.25 1054.75 26 2014-11-28 1041.00 1051.50 28 2014-12-01 1010.75 1022.50 1
can group calendar day of month,'day_of_month', approx 30 per month
goal group business day of month, approx 22/month
is there df.index.buiness_day_of_month type function?
tried importing bday, special calendars , like, without success. thank help.
may helps
dat1$grp <- with(dat1, ave(seq_along(date1), format(date1, '%m'), fun=seq_along)) aggregate(val~grp, dat1, fun=sum)
data
date <- seq(as.date('2014-11-01'), length.out=80, by='1 day') library(timedate) date1 <- date[isbizday(as.timedate(date))] day_of_month <- as.numeric(format(date1, '%d')) set.seed(24) dat1 <- data.frame(date1, day_of_month, val=rnorm(54))
Comments
Post a Comment