I have two list of data one is with date and average values, another one is with index and another value, they look like:
#list 1: (in total 62 raws)
date d_mean
2017-3-1 15.3
2017-3-2 16.9
2017-3-3 18.2
...
2017-4-30 17.7
2017-5-1 15.6
#list2: (in total 10 raws)
sum
121 555
122 784
123 546
...
142 568
143 658
144 847
I want to:
- group the dates into weeks
- calculate the average values for every week and create a new list with column 'week' and 'w_mean'
- make this two list same size then plot them against each other
I tried to use
chunks = [avg_T1[x:x+7] for x in range(4, len(avg_T1), 7)]
but this just divided the list, I tried to add
.mean()
in the end, doesn't really work.
I'm new to Python, I'm also glad to hear if there are any necessary materials that I need to read or practice I have to do to help me gut used to using Python.