censusviz package¶
Submodules¶
censusviz.censusviz module¶
-
censusviz.censusviz.
get_geocen_df
(quality='', year='', area_type='')[source]¶ This function returns a geopandas.GeoDataFrame of Census cartographic files.
- Parameters
quality (a string value of the resolution of the GeoJSON file. The available resolutions are 20m, 5m, and 500k.) –
year (a string value of the year you would like to recall. %Y. Year availables: 1990, 2000, 2010, 2012-2019.) –
area_type (a stringe value of the geography area value you would like to specify.) –
- Returns
- Index:
RangeIndex
- Columns:
GEO_ID: object STATE: object COUNTY: object NAME: object LSAD: object CENSUSAREA: float64 geometry: geometry
- Return type
Output geopandas.GeoDataFrame of the API with stated parameters
Example
censusviz.get_geocen_df(quality = “20m”, year = “2010”, area_type= “county”).shape (3221, 7)
-
censusviz.censusviz.
get_geocen_plot
(quality='', year='', area_type='', boundaries=False)[source]¶ This function returns a matplotlib.pyplot.plot of a specified cartographic area by year, area type and resolution quality.
- Parameters
quality (a string value of the resolution of the GeoJSON file. The available resolutions are 20m, 5m, and 500k.) –
year (a string value of the year you would like to recall. %Y. Year availables: 1990, 2000, 2010, 2012-2019.) –
area_type (a stringe value of the geography area value you would like to specify.) –
= a boolean value that if True returns only the outline/boundaries of the area specified and if false returns the whole are filled in. (boundaries) –
- Returns
- Return type
Output matplotlib.pyplot.plot of the geometric information with stated parameters.
Example
censusviz.get_geocen_plot(quality =”20m”, year=”2010”, area_type=”county”, boundaries=False)
-
censusviz.censusviz.
get_house_est
(api_key, year='', map=False)[source]¶ This function returns a choropleth map in matplotlib.pyplot.plot format or a geopandas.GeoDataFrame of the U.S. housing estimates by year. It utlizes the U.S. Census Bureau Housing Unit Estimate API and the Census GeoJSON database on GitHub.
- Parameters
api_key (a private api key provided by the U.S. Census Bureau. https://www.census.gov/data/developers/data-sets/popest-popproj/popest.html) –
year (a string value of the year you would like to recall. %Y. Year availables: 2018-2019.) –
= a boolean value that if True returns matplotlib.pyplot.plot of the area specified and if false returns a geopandas.GeoDataFrame for the same values. (map) –
- Returns
Output geopandas.GeoDataFrame or a matplotlib.pyplot.plot object of the geometric information with stated parameters.
STATEFP (object)
STATENS (object)
AFFGEOID (object)
GEOID (object)
STUSPS (object)
NAME (object)
LSAD (object)
ALAND (int64)
AWATER (int64)
geometry (geometry)
Housing_Estimates (int32)
Example
censusviz.get_house_est(api_key = my_api_key, year=”2018”, map = False) censusviz.get_house_est(api_key = my_api_key, year=”2019”, map = True)
-
censusviz.censusviz.
get_pop
(api_key, year='', map=False)[source]¶ This function returns a choropleth map in matplotlib.pyplot.plot format or a geopandas.GeoDataFrame of the U.S. population by year. It utlizes the U.S. Census Bureau Population Estimate API and the Census GeoJSON database on GitHub.
- Parameters
api_key (a private api key provided by the U.S. Census Bureau. https://www.census.gov/data/developers/data-sets/popest-popproj/popest.html) –
year (a string value of the year you would like to recall. %Y. Year availables: 2015-2019.) –
= a boolean value that if True returns matplotlib.pyplot.plot of the area specified and if false returns a geopandas.GeoDataFrame for the same values. (map) –
- Returns
Output geopandas.GeoDataFrame or a matplotlib.pyplot.plot object of the geometric information with stated parameters.
STATEFP (object)
STATENS (object)
AFFGEOID (object)
GEOID (object)
STUSPS (object)
NAME (object)
LSAD (object)
ALAND (int64)
AWATER (int64)
geometry (geometry)
Pop_Count (int32)
Example
censusviz.get_pop(api_key = my_api_key, year=”2018”, map = False) censusviz.get_pop(api_key = my_api_key, year=”2019”, map = True)
-
censusviz.censusviz.
get_region_pop
(api_key, year='', map=False)[source]¶ This function returns a choropleth map in matplotlib.pyplot.plot format or a geopandas.GeoDataFrame of the U.S. population by year and region. It utlizes the U.S. Census Bureau Population Estimate API and the Census GeoJSON database on GitHub.
- Parameters
api_key (a private api key provided by the U.S. Census Bureau. https://www.census.gov/data/developers/data-sets/popest-popproj/popest.html) –
year (a string value of the year you would like to recall. %Y. Year availables: 2018-2019.) –
= a boolean value that if True returns matplotlib.pyplot.plot of the area specified and if false returns a geopandas.GeoDataFrame for the same values. (map) –
- Returns
Output geopandas.GeoDataFrame or a matplotlib.pyplot.plot object of the geometric information with stated parameters.
REGIONCE (object)
AFFGEOID (object)
GEOID (object)
NAME (object)
LSAD (object)
ALAND (int64)
AWATER (int64)
geometry (geometry)
Example
censusviz.get_region_pop(api_key = my_api_key, year=”2016”, map = False) censusviz.get_region_pop(api_key = my_api_key, year=”2019”, map = True)
-
censusviz.censusviz.
get_state_ids
(state_initials='')[source]¶ This function returns a pandas.DataFrame of state-related federal codes.
- Parameters
state_initials (a string value of the officially recognized state abbreviation.) –
- Returns
- Index:
RangeIndex
- Columns:
NAME: object STUSPS: object STATEFP: object STATENS: object AFFGEOID: object GEOID: object
- Return type
Output pandas.DataFrame of the API with stated parameters
Example
censusviz.get_state_ids(“OR”).shape (1, 6)
-
censusviz.censusviz.
get_state_pop
(api_key, year='', state_fip='', map=False)[source]¶ This function returns a choropleth map in matplotlib.pyplot.plot format or a geopandas.GeoDataFrame of the U.S. population by year and state. It utlizes the U.S. Census Bureau Population Estimate API and the Census GeoJSON database on GitHub.
- Parameters
api_key (a private api key provided by the U.S. Census Bureau. https://www.census.gov/data/developers/data-sets/popest-popproj/popest.html) –
year (a string value of the year you would like to recall. %Y. Year availables: 2018-2019.) –
state_fip (a string value of the state Federal Information Processing Standard state code.) –
= a boolean value that if True returns matplotlib.pyplot.plot of the area specified and if false returns a geopandas.GeoDataFrame for the same values. (map) –
- Returns
Output geopandas.GeoDataFrame or a matplotlib.pyplot.plot object of the geometric information with stated parameters.
STATE_FIP (object)
COUNTYFP (object)
COUNTYNS (object)
AFFGEOID (object)
GEOID (object)
NAME (object)
LSAD (object)
ALAND (int64)
AWATER (int64)
geometry (geometry)
Pop_Count (int32)
Example
censusviz.get_state_pop(api_key = my_api_key, year=”2016”, state_fip = “15”, map = False) censusviz.get_state_pop(api_key = my_api_key, year=”2019”, state_fip = “29”, map = True)
-
censusviz.censusviz.
list_geoparams
(**kwargs)[source]¶ This function returns a table from the Census’ Github telling users which GeoJSON files are available by Year and geography area type.
- Parameters
year (A string value of the year you would like to recall. %Y. Optional and will return a subset of table if specified.) –
- Returns
- Index:
RangeIndex
- Columns:
Geographic Area Type: object 1990: object 2000: object 2010: object 2012: object 2013 - 2015: object 2016 - 2019: object
- Return type
Output pandas.DataFrame of the webscrapped table with stated parameters
Example
censusviz.list_geoparams().shape (25,7)