Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use python 3, Thanks! >>> print(raw_data) ([[4, 17, 67, 76, 51, 28, 3, 1, 0, 0, 0, 1], [0, 1, 8, 28, 69, 129, 83,

Use python 3, Thanks!image text in transcribed>>> print(raw_data) ([[4, 17, 67, 76, 51, 28, 3, 1, 0, 0, 0, 1], [0, 1, 8, 28, 69, 129, 83, 55, 19, 4, 0, 0], [0, 0, 0, 8, 86, 55, 0, 0, 0, 0, 0, 0], [0, 0, 1, 10, 24, 43, 64, 58, 58, 26, 12, 0], [0, 0, 2, 15, 56, 116, 51, 8, 0, 0, 0, 0]], 1337, 13)

image text in transcribed

Write a function parse_data (filename) that reads in a series of records from a file, each corresponding to a reported case of flu (from the years 2010-2014), and converts the data into a collection of monthly case counts for each year. The function should return a 3-tuple containing a nested list of monthly case counts for each year. This nested list should be 5 x 12 elements in size (please see below in the example); the number of valid records; and the number of invalid records The data in the file consists of records. Each record consists of four items: year, month (3-character code), age and sex. You will only need to use the first two items (year and month) This is an example of the data in the file case list.csv year,month,age,sex 2011,APR, 29,M 2011,MAR,37,F 2012,MAY,63,M 2012,Mxx,63,M Assumptions You can assume that each record is correctly formatted, but your function should only count valid records. A valid record is a record that has valid values for year and month. Valid years are: 2010, 2011,2012,2013,2014 Valid months are: JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC Invalid records should be ignored >>> raw-data parse-data( 'case-list.csv ') =

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions