I am writing a piece of code that iterates through each record and prints a statistic called intervals.
for record in records:
from collections import Counter
count = Counter(intervals)
for interval, frequency in count.iteritems():
print interval
print frequency
The output looks like this:
Record 1
199
7
200
30
Record 2
199
6
200
30
In this example, in Record 1, there are 7 instances of the interval length 199 and 30 instances of the interval length 200. In Record 2, there are 6 instances of the interval length 199 and 31 instances of the interval length 200. I would like to see the overall stat summary of both records like this but cannot figure out how to get these results:
All Records
199
13
200
61
Where in both records, there are 13 instances total of interval length 199 (7+6) and 61 instances total of interval length 200 (30+31). I am having trouble getting the overall statistic summary of my records as shown above.