I want to split a dataframe with date range 1 week, with each week data in different column.

kkarthik
New Contributor

DF

Q Date(yyyy-mm-dd)

q1 2017-10-01

q2 2017-10-03

q1 2017-10-09

q3 2017-10-06

q2 2017-10-01

q1 2017-10-13

Q1 2017-10-02

Q3 2017-10-21

Q4 2017-10-17

Q5 2017-10-20

Q4 2017-10-31

Q2 2017-10-27

Q5 2017-10-01

Dataframe:

Q Count(week 1) Count(week 2) Count(week 3) Count(week 4) Avg(counts) Standard deviation of the counts

Q1 2 2 0 0 As applicable As applicable

Q2 2 0 0 1 “ “

Q3 1 0 1 0 “ “

Q4 0 0 1 1

Q5 1 0 1 0 “ “