I would like to know how can I find the difference between maximum and minimum values of three columns in python. (The columns name are POPESTIMATE2010-POPESTIMATE2012) Then I should find the maximum result among all my records. in other words, Which county has had the largest absolute change in population within the period 2010-2012?
e.g. If County Population in the 3 year period is 100, 80, 130, then its largest change in the period would be |130-80| = 50.
import pandas as pd
census_df = pd.read_csv('census.csv')
def answer_one():
return ((census_df['POPESTIMATE2010'],census_df ['POPESTIMATE2011'],census_df ['POPESTIMATE2012']).max()-(census_df['POPESTIMATE2010'],census_df ['POPESTIMATE2011'],census_df ['POPESTIMATE2012']).min()).max()
answer_one()
