Use GeoPandas to map population density
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data
.gitignore
LICENSE
README.md
us_states.ipynb

README.md

Census play

Use Wikipedia to get state population. Use US census to get state areas and shapes. Use jupyter notebook and pandas to import data and calculate population density. Use GeoPandas to map population density.

Results

activate environment

conda activate beepscore

start jupyter server

jupyter lab

References

Anaconda

Python version 3.6.1

Pandas version 0.23.0

geopandas

http://geopandas.org/mapping.html

Python and Pandas introductory tutorials and examples

Sentdex youtube channel is AWESOME!

https://pythonprogramming.net/data-analysis-python-pandas-tutorial-introduction/ https://youtu.be/Iqjy9UqKKuo?list=PLQVvvaa0QuDc-3szzjeP6N6b0aDrrKyL-

beepscore repo based on Sentdex intro

https://github.com/beepscore/data_analysis_tutorial

Learn Python Through Public Data Hacking by David Beazley

Some examples use Pandas. has code samples downloadable data files https://dabeaz.com/pydata/ https://www.youtube.com/watch?v=RrPZza_vZ3w

beepscore repo based on Beazley Do tutorial Learn Python Through Public Data Hacking

https://github.com/beepscore/Learn-Python-Through-Public-Data-Hacking

GeoPandas

Creating a Choropleth Map of the World in Python using GeoPandas

http://ramiro.org/notebook/geopandas-choropleth/

Using Python and GeoPandas on US Census Data

shows examples of slicing https://n8henrie.com/uploads/2017/11/plotting-us-census-data-with-python-and-geopandas.html

Let’s make a map! Using Geopandas, Pandas and Matplotlib to make a Choropleth map

https://towardsdatascience.com/lets-make-a-map-using-geopandas-pandas-and-matplotlib-to-make-a-chloropleth-map-dddc31c1983d

Making a Geographic Heatmap with Python

very pretty, overlays "hot zones" on map showing roads https://alcidanalytics.com/p/geographic-heatmap-in-python

Three ways to make a choropleth

shows Folium, I didn't try it https://ocefpaf.github.io/python4oceanographers/blog/2015/08/24/choropleth/

Data sources

Wikipedia

List of states and territories of the United States by population

https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States_by_population

List of states and territories of the United States by population density

https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States_by_population_density

US Census

US Census has many databases and apis. So many it can be difficult to find what you want!

Cartographic Boundary Shapefiles - States

https://www.census.gov/geo/maps-data/data/cbf/cbf_state.html

State Area Measurements and Internal Point Coordinates

https://www.census.gov/geo/reference/state-area.html

api

https://www.census.gov/data/developers/guidance/api-user-guide.html