import pandas as pd
import folium
county_geo = "counties.geojson"
county_poverty= "ChiefKeef2.csv"
county_data = pd.read_csv(county_poverty)
#county_data['NAME'] = county_data['NAME'].astype('str')
#county_data['x'] = county_data['x'].astype('int')
m = folium.Map(location=[48, -102], zoom_start=3)
folium.Choropleth(
geo_data=county_geo,
name="choropleth",
data=county_data,
columns=['NAME', 'x'],
key_on="feature.properties.NAME",
fill_color="YlOrRd",
fill_opacity=0.7,
line_opacity=0.2,
legend_name="Obesity Rate",
).add_to(m)
folium.LayerControl().add_to(m)
m
import pandas as pd
import folium
county_geo = "counties.geojson"
county_poverty= "ChiefKeef2.csv"
county_data = pd.read_csv(county_poverty)
#county_data['NAME'] = county_data['NAME'].astype('str')
#county_data['x'] = county_data['x'].astype('int')
m = folium.Map(location=[48, -102], zoom_start=3)
folium.Choropleth(
geo_data=county_geo,
name="choropleth",
data=county_data,
columns=['NAME', 'y'],
key_on="feature.properties.NAME",
fill_color="YlOrRd",
fill_opacity=0.7,
line_opacity=0.2,
legend_name="Poverty Rate",
).add_to(m)
folium.LayerControl().add_to(m)
m
import matplotlib.pyplot as plt
import csv
%matplotlib inline
import os
from matplotlib import pyplot as plt
import pandas as pd
import seaborn as sb
Data_Points = pd.read_csv("CountyObesityPovertyDolla.csv")
features = Data_Points[["x","y"]]
plt.scatter(features['x'], features['y'])
plt.xlabel('Obesity Percentage')
plt.ylabel('Poverty Percentage')
plt.title('Obesity vs. Poverty by US County')
plt.gcf().set_size_inches((26,26))
Data_Points.corr(method='pearson')
sb.regplot(x = "x", y = "y", ci = None, data = Data_Points)
import pandas as pd
Data_Points = pd.read_csv("CountyObesityPovertyDolla.csv")
Data_Points.corr(method='pearson')
import pandas as pd
Data_Points = pd.read_csv("CountyObesityPovertyDolla.csv")
Data_Points[["x","y"]].describe()
import csv
%matplotlib inline
import os
from matplotlib import pyplot as plt
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sb
Data_Points = pd.read_csv("ObesityPoverty.csv")
features = Data_Points[["X","Y"]]
plt.scatter(features['X'], features['Y'])
plt.xlabel('Obesity Percentage')
plt.ylabel('Poverty Percentage')
plt.title('Obesity vs. Poverty by US State with Linear Regression')
sb.regplot(x = "X", y = "Y", ci = None, data = Data_Points)
#Alternate Regression Code
#b, a = np.polyfit(features['X'], features['Y'], deg=1)
#xseq = np.linspace(25, 40, num=50)
#plt.plot(xseq, a + b * xseq, color="k", lw=2.5);
import pandas as pd
Data_Points2 = pd.read_csv("ObesityPoverty.csv")
Data_Points2.corr(method='pearson')
import pandas as pd
Data_Points = pd.read_csv("ObesityPoverty.csv")
Data_Points[["X","Y"]].describe()
#.26846 Results of the pearson correlation indicated that there is a significant small positive relationshi between X and Y, (r(3140) = .285, p < .001)