Location Codes
Let’s import libraries, and open our data up.
import pandas as pd
import numpy as np
import gmplot
Assess_Combined = pd.DataFrame.from_csv("Assess_Combined.csv",encoding="UTF-8")
Now, we want a way to represent both the latitude and longitude together. Here is how we will do it.
print(Assess_Combined["Lat Group"].astype(str)+"-"+Assess_Combined["Lon Group"].astype(str))
First off, we have to use .astype(str) to convert our integer groups to strings. We are then putting the two together with a dash to seperate them. Let’s assign this to a new column which we will call loc code.
Assess_Combined["LocCode"] = Assess_Combined["Lat Group"].astype(str)+"-"+Assess_Combined["Lon Group"].astype(str)
Challenge
Turn our data into a dataset of each location code, and their average values for each variable.