3: Pandas and zombies
As part of a health study, the residents of 10 condominium buildings have all been given wireless fitness bracelets that record heart rate and motion.
Suddenly, some of the apartment dwellers become zombies. The zombies go rampaging through the buildings, turning the other apartment dwellers into zombies.
Fortunately, some people had been taught how to kill zombies in a secret zombie defense course, and they are able to teach the other people who live in the apartment building.
The buildings are put in lock down, but the data from the wireless fitness bracelets keeps being recorded. This is useful for tracking zombies, because it turns out that zombies have no heart rate but are moving.
Your task is to find out how effective the zombie
defense course was. As input, you are given two JSON files:
- buildinginfo.json
Contains data on the occupancy of each of the 10 buildings, how many people in them were trained zombie killers.
- peopletracking.json
Hourly data from the fitness bracelets for each person in those buildings for seven days since the zombie outbreak, giving the building they are in, their heart rate, and whether they are moving.
Use pandas to read these files into dataframes and answer the follow questions:
- Which buildings can be safely unlocked after seven days?
- What would have been the earliest time that these safe buildings could have been unlocked?
- For each building, determine the final survival rate R, i.e., the number of people with a non-zero heart rate divided by the total number of people in the building. Also determine the percentage of occupants of each building trained in killing zombies, call it T.
- Creates a plot of all (T,R) pairs; make it professional, i.e., everything is properly labeled and legible.
All parts should be done using python scripts (you may use one script or several, if you wish). Submit your script(s), with the answers to these questions in the comments in the code, and your plot by March 2nd, 2022 at midnight. Remember to comment your code properly.
- 16 February 2022, 11:55 PM
- 16 February 2022, 11:55 PM