- Read in the raw weight_loss dataset, and examine the first month of data from the two people, Amy and Bob. There are a total of four weigh-ins per month:
>>> weight_loss = pd.read_csv('data/weight_loss.csv')>>> weight_loss.query('Month == "Jan"')
- To determine the winner for each month, we only need to compare weight loss from the first week to the last week of each month. But, if we wanted to have weekly updates, we can also calculate weight loss from the current week to the first week of each month. Let's create a function that is capable of providing weekly updates:
>>> def find_perc_loss(s): return (s - s.iloc) / ...
Get Numerical Computing with Python now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.