This page was generated from notebooks/fetch.ipynb.
Interactive online version:
[1]:
import libpysal
[2]:
libpysal.examples.fetch_all()
downloading dataset from https://s3.amazonaws.com/geoda/data/guerry.zip to /home/jovyan/pysal_data
Extracting files....
downloading dataset from https://github.com/sjsrey/rio_grande_do_sul/archive/master.zip to /home/jovyan/pysal_data
Extracting files....
downloading dataset from https://s3.amazonaws.com/geoda/data/ncovr.zip to /home/jovyan/pysal_data
Extracting files....
downloading dataset from https://github.com/sjsrey/nyc_bikes/archive/master.zip to /home/jovyan/pysal_data
Extracting files....
downloading dataset from https://s3.amazonaws.com/geoda/data/SacramentoMSA2.zip to /home/jovyan/pysal_data
Extracting files....
downloading dataset from https://s3.amazonaws.com/geoda/data/south.zip to /home/jovyan/pysal_data
Extracting files....
downloading dataset from https://github.com/sjsrey/taz/archive/master.zip to /home/jovyan/pysal_data
Extracting files....
[3]:
from libpysal.examples import nat
[4]:
nat.fetch_nat()
already exists, not downloading
[5]:
from os import environ
[6]:
environ.get("PYSALDATA")
[6]:
'/home/jovyan/pysal_data'
[7]:
from libpysal.examples import south
[8]:
sd = south.fetch_south()
already exists, not downloading
[9]:
from libpysal.examples import guerry
[10]:
guerry.fetch_guerry()
already exists, not downloading
[11]:
libpysal.examples.explain('guerry')
guerry
======
Andre-Michel Guerry data on "moral statistics" 1930 crime, suicide, literacy and other “moral statistics” in 1830s France.
- Observations = 85
- Variables = 23
- Years = 1915-1934
- Support = polygon
Files
-----
Guerry.dbf Guerry_documentation.html Guerry.geojson Guerry.prj Guerry.shp Guerry.shx README.md
Variables
---------
dept, code_de Department ID: Standard numbers for the departments
region Region of France (‘N’=’North’, ‘S’=’South’, ‘E’=’East’, ‘W’=’West’, ‘C’=’Central’). Corsica is coded as NA.
dprtmnt Department name: Departments are named according to usage in 1830, but without accents. A factor with levels Ain Aisne Allier … Vosges Yonne
crm_prs Population per Crime against persons. A2. Compte général, 1825-1830
crm_prp Population per Crime against property. Compte général, 1825-1830
litercy Percent of military conscripts who can read and write. A2
donatns Donations to the poor. A2. Bulletin des lois
infants Population per illegitimate birth. A2. Bureau des Longitudes, 1817-1821
suicids Population per suicide. A2. Compte général, 1827-1830
maincty Size of principal city (‘1:Sm’, ‘2:Med’, ‘3:Lg’), used as a surrogate for population density. Large refers to the top 10, small to the bottom 10; all the rest are classed Medium. A1. An ordered factor with levels: 1:Sm < 2:Med < 3:Lg
wealth Per capita tax on personal property. A ranked index based on taxes on personal and movable property per inhabitant. A1
commerc Commerce and Industry, measured by the rank of the number of patents / population. A1
clergy Distribution of clergy, measured by the rank of the number of Catholic priests in active service population. A1. Almanach officiel du clergy, 1829
crim_prn Crimes against parents, measured by the rank of the ratio of crimes against parents to all crimes – Average for the years 1825-1830. A1. Compte général
infntcd Infanticides per capita. A ranked ratio of number of infanticides to population – Average for the years 1825-1830. A1. Compte général
dntn_cl Donations to the clergy. A ranked ratio of the number of bequests and donations inter vivios to population – Average for the years 1815-1824. A1. Bull. des lois, ordunn. d’autorisation
lottery Per capita wager on Royal Lottery. Ranked ratio of the proceeds bet on the royal lottery to population — Average for the years 1822-1826. A1. Compte rendu par le ministre des finances
desertn Military desertion, ratio of number of young soldiers accused of desertion to the force of the military contingent, minus the deficit produced by the insufficiency of available billets – Average of the years 1825-1827. A1. Compte du ministère du guerre, 1829 état V
instrct Instruction. Ranks recorded from Guerry’s map of Instruction. Note: this is inversely related to Literacy
Prsttts Number of prostitutes registered in Paris from 1816 to 1834, classified by the department of their birth Parent-Duchatelet (1836), De la prostitution en Paris
distanc Distance to Paris (km). Distance of each department centroid to the centroid of the Seine (Paris) Calculated from department centroids
area Area (1000 km^2). Angeville (1836)
pop1831 Population in 1831, in 1000s Taken from Angeville (1836), Essai sur la Statistique de la Population français
Details
Note that most of the variables (e.g., Crime_pers) are scaled so that more is “better”.
Values for the quantitative variables displayed on Guerry’s maps were taken from Table A2 in the English translation of Guerry (1833) by Whitt and Reinking. Values for the ranked variables were taken from Table A1, with some corrections applied. The maximum is indicated by rank 1, and the minimum by rank 86.
Sources
Angeville, A. (1836). Essai sur la Statistique de la Population française Paris: F. Doufour.
Guerry, A.-M. (1833). Essai sur la statistique morale de la France Paris: Crochard. English translation: Hugh P. Whitt and Victor W. Reinking, Lewiston, N.Y. : Edwin Mellen Press, 2002.
Parent-Duchatelet, A. (1836). De la prostitution dans la ville de Paris, 3rd ed, 1857, p. 32, 36
References
Dray, S. and Jombart, T. (2011). A Revisit Of Guerry’s Data: Introducing Spatial Constraints In Multivariate Analysis. The Annals of Applied Statistics, Vol. 5, No. 4, 2278-2299., DOI: 10.1214/10-AOAS356.
Brunsdon, C. and Dykes, J. (2007). Geographically weighted visualization: interactive graphics for scale-varying exploratory analysis. Geographical Information Science Research Conference (GISRUK 07), NUI Maynooth, Ireland, April, 2007.
Friendly, M. (2007). A.-M. Guerry’s Moral Statistics of France: Challenges for Multivariable Spatial Analysis. Statistical Science, 22, 368-399.
Friendly, M. (2007). Data from A.-M. Guerry, Essay on the Moral Statistics of France (1833).
See Also
The Guerry package for maps of France: gfrance and related data.
Prepared by Center for Spatial Data Science. Last updated July 3, 2017. Data provided “as is,” no warranties.
[12]:
libpysal.examples.get_path('Guerry.geojson')
[12]:
'/home/jovyan/pysal_data/guerry/Guerry.geojson'
[13]:
libpysal.examples.explain('south')
south
=====
Homicides and selected socio-economic characteristics for Southern U.S. counties.
---------------------------------------------------------------------------------
- Observations = 1,412
- Variables = 69
- Years = 1960-90s
- Support = polygon
Files
-----
south.gdb README.md south.dbf south.gpkg south.kml south.mif south.shp south.sqlite
codebook.pdf south.csv south.geojson south.html south.mid south.prj south.shx south.xlsx
Variables
---------
NAME county name
STATE_NAME state name
STATE_FIPS state fips code (character)
CNTY_FIPS county fips code (character)
FIPS combined state and county fips code (character)
STFIPS state fips code (numeric)
COFIPS county fips code (numeric)
FIPSNO fips code as numeric variable
SOUTH dummy variable for Southern counties (South = 1)
HR** homicide rate per 100,000 (1960, 1970, 1980, 1990)
HC** homicide count, three year average centered on 1960, 1970, 1980, 1990
PO** county population, 1960, 1970, 1980, 1990
RD** resource deprivation 1960, 1970, 1980, 1990 (principal component, see Codebook for details)
PS** population structure 1960, 1970, 1980, 1990 (principal component, see Codebook for details)
UE** unemployment rate 1960, 1970, 1980, 1990
DV** divorce rate 1960, 1970, 1980, 1990 (% males over 14 divorced)
MA** median age 1960, 1970, 1980, 1990
POL** log of population 1960, 1970, 1980, 1990
DNL** log of population density 1960, 1970, 1980, 1990
MFIL** log of median family income 1960, 1970, 1980, 1990
FP** % families below poverty 1960, 1970, 1980, 1990 (see Codebook for details)
BLK** % black 1960, 1970, 1980, 1990
GI** Gini index of family income inequality 1960, 1970, 1980, 1990
FH** % female headed households 1960, 1970, 1980, 1990
[14]:
libpysal.examples.get_path('south.shp')
[14]:
'/home/jovyan/pysal_data/south/south.shp'
[15]:
libpysal.examples.get_path('missing.shp')
missing.shp not found.
[16]:
pth = libpysal.examples.get_path('south.shp')
[17]:
pth
[17]:
'/home/jovyan/pysal_data/south/south.shp'
[18]:
import geopandas as gpd
[19]:
df = gpd.read_file(pth)
[20]:
df.head()
[20]:
NAME | STATE_NAME | STATE_FIPS | CNTY_FIPS | FIPS | STFIPS | COFIPS | FIPSNO | SOUTH | HR60 | ... | BLK90 | GI59 | GI69 | GI79 | GI89 | FH60 | FH70 | FH80 | FH90 | geometry | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | Hancock | West Virginia | 54 | 029 | 54029 | 54 | 29 | 54029 | 1 | 1.682864 | ... | 2.557262 | 0.223645 | 0.295377 | 0.332251 | 0.363934 | 9.981297 | 7.8 | 9.785797 | 12.604552 | POLYGON ((-80.6280517578125 40.39815902709961,... |
1 | Brooke | West Virginia | 54 | 009 | 54009 | 54 | 9 | 54009 | 1 | 4.607233 | ... | 0.748370 | 0.220407 | 0.318453 | 0.314165 | 0.350569 | 10.929337 | 8.0 | 10.214990 | 11.242293 | POLYGON ((-80.52625274658203 40.16244888305664... |
2 | Ohio | West Virginia | 54 | 069 | 54069 | 54 | 69 | 54069 | 1 | 0.974132 | ... | 3.310334 | 0.272398 | 0.358454 | 0.376963 | 0.390534 | 15.621643 | 12.9 | 14.716681 | 17.574021 | POLYGON ((-80.52516937255859 40.02275085449219... |
3 | Marshall | West Virginia | 54 | 051 | 54051 | 54 | 51 | 54051 | 1 | 0.876248 | ... | 0.546097 | 0.227647 | 0.319580 | 0.320953 | 0.377346 | 11.962834 | 8.8 | 8.803253 | 13.564159 | POLYGON ((-80.52446746826172 39.72112655639648... |
4 | New Castle | Delaware | 10 | 003 | 10003 | 10 | 3 | 10003 | 1 | 4.228385 | ... | 16.480294 | 0.256106 | 0.329678 | 0.365830 | 0.332703 | 12.035714 | 10.7 | 15.169480 | 16.380903 | POLYGON ((-75.77269744873047 39.38300704956055... |
5 rows × 70 columns
[21]:
from libpysal.examples.sacramento2 import fetch_sacramento2
[22]:
fetch_sacramento2()
already exists, not downloading
[23]:
libpysal.examples.explain('sacramento2')
sacramento2
===========
2000 Census Tract Data for Sacramento MSA
-----------------------------------------
- Observations = 83
- Variables = 66
- Years = 1998, 2001
- Support = polygon
Files
-----
SacramentoMSA2.gdb SacramentoMSA2.kml SacramentoMSA2.shp
README.md SacramentoMSA2.mid SacramentoMSA2.shx
SacramentoMSA2.csv SacramentoMSA2.mif SacramentoMSA2.sqlite
SacramentoMSA2.dbf SacramentoMSA2.prj SacramentoMSA2.xlsx
SacramentoMSA2.geojson SacramentoMSA2.sbn 'Variable Info for Zip Code File.pdf'
SacramentoMSA2.gpkg SacramentoMSA2.sbx
Variables
---------
ZIP ZIP code
PO_NAME Name of ZIP code area
STATE STATE
MSA MSA
CBSA_CODE CBSA code
MAN98 1998 total manufacturing establishments (MSA)
MAN98_12 1998 total manufacturing establishments, 1-9 employees (MSA)
MAN98_39 1998 total manufacturing establishments 10+ employees (MSA)
MAN01 2001 total manufacturing establishments (MSA)
MAN01_12 2001 total manufacturing establishments, 1-9 employees (MSA)
MAN01_39 2001 total manufacturing establishments, 10+ employees (MSA)
MAN98US 1998 total manufacturing establishments (US)
MAN98US12 1998 total manufacturing establishments, 1-9 employees (US)
MAN98US39 1998 total manufacturing establishments 10+ employees (US)
MAN01US 2001 total manufacturing establishments (US)
MAN01US_12 2001 total manufacturing establishments, 1-9 employees (US)
MAN01US_39 2001 total manufacturing establishments, 10+ employees (US)
OFF98 1998 total office establishments (MSA)
OFF98_12 1998 total office establishments, 1-9 employees (MSA)
OFF98_39 1998 total office establishments, 10+ employees (MSA)
OFF01 2001 total office establishments (MSA)
OFF01_12 2001 total office establishments, 1-9 employees (MSA)
OFF01_39 2001 total office establishments, 10+ employees (MSA)
OFF98US 1998 total office establishments (US)
OFF98US12 1998 total office establishments, 1-9 employees (US)
OFF98US39 1998 total office establishments, 10+ employees (US)
OFF01US 2001 total office establishments (US)
OFFUS01_12 2001 total office establishments, 1-9 employees (US)
OFFUS01_39 2001 total office establishments, 10+ employees (US)
INFO98 1998 total information establishments (MSA)
INFO98_12 1998 total information establishments, 1-9 employees (MSA)
INFO98_39 1998 total information establishments, 10+ employees (MSA)
INFO01 2001 total information establishments (MSA)
INFO01_12 2001 total information establishments, 1-9 employees (MSA)
INFO01_39 2001 total information establishments, 10+ employees (MSA)
INFO98US 1998 total information establishments (US)
INFO98US12 1998 total information establishments, 1-9 employees (US)
INFO98US39 1998 total information establishments, 10+ employees (US)
INFO01US 2001 total information establishments (US)
INFO01US_1 2001 total information establishments, 1-9 employees (US)
INFO01US_3 2001 total information establishments, 10+ employees (US)
INDEX Index
NUMSEC Number of sectors represented in ZIP code
EST98 Total establishments in ZIP code, 1998
EST01 Total establishments in ZIP code, 2001
PCTNGE National growth effect, percent (N)
PCTIME Industry mix effect, percent (M)
PCTCSE Competitive shift effect, percent (S)
PCTGRO Percent growth establishments, 1998-2001 (R)
ID Unique ZIP code ID for ID variables in weights matrix creation window
Source: US Census Bureau, 2000 Census (Summary File 3). Extracted from http://factfinder.census.gov in April 2004.
[24]:
libpysal.examples.get_path("10740.shx")
[24]:
'/home/jovyan/libpysal/examples/10740/10740.shx'
[25]:
from libpysal.examples.nyc_bikes import fetch_bikes
[26]:
fetch_bikes()
already exists, not downloading
[27]:
libpysal.examples.get_path('nyct2010.shp')
[27]:
'/home/jovyan/pysal_data/nyc_bikes/nyct2010.shp'
[28]:
from libpysal.examples.rio_grande_do_sul import fetch_rio
fetch_rio()
already exists, not downloading
[29]:
libpysal.examples.get_path('map_RS_BR.shp')
[29]:
'/home/jovyan/pysal_data/rio_grande_do_sul/map_RS_BR.shp'
[ ]:
from libpysal.examples.taz import fetch_taz
fetch_taz()
[ ]:
libpysal.examples.get_path('taz.dbf')
[ ]: