April 13, 2020 - noah-and-ethan/index.github.io GitHub Wiki
ANALYSIS
After further analysis of the code that we found we broke it up into 3 parts (what we need, what we need to tweak, and what we need to delete). We found that the first part of the code which was making merging the data. This did need tweaking to fit our specifications but we had a rough idea on how to go about making our code.
We took out the bokeh part as we are using leaflet so that wasn't a need for us.
then I broke the code into chunks and started annotating it and tweaking it so that it matched my end goal.
example:
import geopandas as gpd
shapefile = 'data/countries_110m/ne_110m_admin_0_countries.shp'
#Read shapefile using Geopandas
gdf = gpd.read_file(shapefile)['ADMIN', 'ADM0_A3', 'geometry'](/noah-and-ethan/index.github.io/wiki/'ADMIN',-'ADM0_A3',-'geometry')
#Rename columns.
gdf.columns = ['country', 'country_code', 'geometry']
gdf.head()
import pandas as pd
datafile = 'data/covid-19.csv'
#Read csv file using pandas
df = pd.read_csv(datafile, names = ['entity', 'code', 'year', 'per_cent_obesity'], skiprows = 1)
df.head()
This imports 2 data frames so that we can merge them later. The gdf is for the polygon which gives the shape of the country.