I have a dataframe of a collection of data and i have it grouped by 2 different groups not sure how to go about doing calculations or even pull the specific cell I'm looking at
ZipCode(group1) Year(group2) Valuex x2 x3
10001 2012 1 7 12
2013 5 1 13
2014 6 8 15
10002 2012 x x x
2013 x x x
2014 x x x
So I am still learning about DataFrames; I really don't know where to go from here, I can do .sum()
or .mean()
but it's not what I'm looking to do.
I'm looking to grab the first and last year of each zip and get the change in percent.
So for zipcode = 10001
I would want to pull 2014x -2012x/2012x
But for each zipcode, and if left ungrouped the zips repeat in the 100 thousands
this is my actual dataframe:
Example would be zcta5 00601 Median Home Value change over time would be its 2017 value - its 2012 value divided by 2012 value