-
Introduction 1
-
Lecture1.1
-
-
Getting the Data 4
-
Lecture2.1
-
Lecture2.2
-
Lecture2.3
-
Lecture2.4
-
-
Location Groups 3
-
Lecture3.1
-
Lecture3.2
-
Lecture3.3
-
-
Creating the New Data 3
-
Lecture4.1
-
Lecture4.2
-
Lecture4.3
-
-
Mapping the Data 3
-
Lecture5.1
-
Lecture5.2
-
Lecture5.3
-
Boundary Lines
Solution
Assess_Combined = Assess_Combined.groupby("LocCode").mean()
First, let’s bring back the numbers from before.
latMax = 42.39615117
latMin = 42.23108386
lonMax = -70.92757284
lonMin = -71.18485204
slice_constant = 100
latIncrement = (latMax-latMin)/slice_constant
lonIncrement = (lonMax-lonMin)/slice_constant
We are going to give each location code a lower, middle, and upper bound. The way we will do it is by multiplying by the lat or lon group.
Assess_Combined["Lat 0"] = latMin+Assess_Combined["Lat Group"]*latIncrement
Assess_Combined["Lat 1"] = latMin+(Assess_Combined["Lat Group"]+.5)*latIncrement
Assess_Combined["Lat 2"] = latMin+(Assess_Combined["Lat Group"]+1)*latIncrement
Assess_Combined["Lon 0"] = lonMin+Assess_Combined["Lon Group"]*lonIncrement
Assess_Combined["Lon 1"] = lonMin+(Assess_Combined["Lon Group"]+.5)*lonIncrement
Assess_Combined["Lon 2"] = lonMin+(Assess_Combined["Lon Group"]+1)*lonIncrement
We will save this under a new name.
Assess_Combined.to_csv("MapData.csv",encoding="UTF-8")
Source Code
Prev
Location Codes
Next
Introduction