{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import libpysal"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "downloading dataset from https://s3.amazonaws.com/geoda/data/guerry.zip to /home/jovyan/pysal_data\n",
      "Extracting files....\n",
      "downloading dataset from https://github.com/sjsrey/rio_grande_do_sul/archive/master.zip to /home/jovyan/pysal_data\n",
      "Extracting files....\n",
      "downloading dataset from https://s3.amazonaws.com/geoda/data/ncovr.zip to /home/jovyan/pysal_data\n",
      "Extracting files....\n",
      "downloading dataset from https://github.com/sjsrey/nyc_bikes/archive/master.zip to /home/jovyan/pysal_data\n",
      "Extracting files....\n",
      "downloading dataset from https://s3.amazonaws.com/geoda/data/SacramentoMSA2.zip to /home/jovyan/pysal_data\n",
      "Extracting files....\n",
      "downloading dataset from https://s3.amazonaws.com/geoda/data/south.zip to /home/jovyan/pysal_data\n",
      "Extracting files....\n",
      "downloading dataset from https://github.com/sjsrey/taz/archive/master.zip to /home/jovyan/pysal_data\n",
      "Extracting files....\n"
     ]
    }
   ],
   "source": [
    "libpysal.examples.fetch_all()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from libpysal.examples import nat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "already exists, not downloading\n"
     ]
    }
   ],
   "source": [
    "nat.fetch_nat()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "from os import environ"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/home/jovyan/pysal_data'"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "environ.get(\"PYSALDATA\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "from libpysal.examples import south"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "already exists, not downloading\n"
     ]
    }
   ],
   "source": [
    "sd = south.fetch_south()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "from libpysal.examples import guerry"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "already exists, not downloading\n"
     ]
    }
   ],
   "source": [
    "guerry.fetch_guerry()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "guerry\n",
      "======\n",
      "\n",
      "Andre-Michel Guerry data on \"moral statistics\" 1930 crime, suicide, literacy and other “moral statistics” in 1830s France.\n",
      "\n",
      "- Observations = 85\n",
      "- Variables = 23\n",
      "- Years = 1915-1934\n",
      "- Support = polygon\n",
      "\n",
      "Files\n",
      "-----\n",
      "Guerry.dbf  Guerry_documentation.html  Guerry.geojson  Guerry.prj  Guerry.shp  Guerry.shx  README.md\n",
      "\n",
      "\n",
      "Variables\n",
      "---------\n",
      "\n",
      "dept, code_de \tDepartment ID: Standard numbers for the departments \t \n",
      "region \tRegion of France (‘N’=’North’, ‘S’=’South’, ‘E’=’East’, ‘W’=’West’, ‘C’=’Central’). Corsica is coded as NA. \t \n",
      "dprtmnt \tDepartment name: Departments are named according to usage in 1830, but without accents. A factor with levels Ain Aisne Allier … Vosges Yonne \t \n",
      "crm_prs \tPopulation per Crime against persons. \tA2. Compte général, 1825-1830\n",
      "crm_prp \tPopulation per Crime against property. \tCompte général, 1825-1830\n",
      "litercy \tPercent of military conscripts who can read and write. \tA2 \n",
      "donatns \tDonations to the poor. \tA2. Bulletin des lois\n",
      "infants \tPopulation per illegitimate birth. \tA2. Bureau des Longitudes, 1817-1821\n",
      "suicids \tPopulation per suicide. \tA2. Compte général, 1827-1830\n",
      "maincty \tSize 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. \tA1. An ordered factor with levels: 1:Sm < 2:Med < 3:Lg\n",
      "wealth \tPer capita tax on personal property. A ranked index based on taxes on personal and movable property per inhabitant. \tA1\n",
      "commerc \tCommerce and Industry, measured by the rank of the number of patents / population. \tA1\n",
      "clergy \tDistribution of clergy, measured by the rank of the number of Catholic priests in active service population. \tA1. Almanach officiel du clergy, 1829\n",
      "crim_prn \tCrimes against parents, measured by the rank of the ratio of crimes against parents to all crimes – Average for the years 1825-1830. \tA1. Compte général\n",
      "infntcd \tInfanticides per capita. A ranked ratio of number of infanticides to population – Average for the years 1825-1830. \tA1. Compte général\n",
      "dntn_cl \tDonations to the clergy. A ranked ratio of the number of bequests and donations inter vivios to population – Average for the years 1815-1824. \tA1. Bull. des lois, ordunn. d’autorisation\n",
      "lottery \tPer capita wager on Royal Lottery. Ranked ratio of the proceeds bet on the royal lottery to population — Average for the years 1822-1826. \tA1. Compte rendu par le ministre des finances\n",
      "desertn \tMilitary 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. \tA1. Compte du ministère du guerre, 1829 état V\n",
      "instrct \tInstruction. Ranks recorded from Guerry’s map of Instruction. Note: this is inversely related to Literacy \t \n",
      "Prsttts \tNumber of prostitutes registered in Paris from 1816 to 1834, classified by the department of their birth \tParent-Duchatelet (1836), De la prostitution en Paris\n",
      "distanc \tDistance to Paris (km). Distance of each department centroid to the centroid of the Seine (Paris) \tCalculated from department centroids\n",
      "area \tArea (1000 km^2). \tAngeville (1836)\n",
      "pop1831 \tPopulation in 1831, in 1000s \tTaken from Angeville (1836), Essai sur la Statistique de la Population français\n",
      "Details\n",
      "\n",
      "Note that most of the variables (e.g., Crime_pers) are scaled so that more is “better”. \n",
      "\n",
      "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. \n",
      "Sources\n",
      "\n",
      "Angeville, A. (1836). Essai sur la Statistique de la Population française Paris: F. Doufour. \n",
      "\n",
      "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. \n",
      "\n",
      "Parent-Duchatelet, A. (1836). De la prostitution dans la ville de Paris, 3rd ed, 1857, p. 32, 36 \n",
      "References\n",
      "\n",
      "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. \n",
      "\n",
      "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. \n",
      "\n",
      "Friendly, M. (2007). A.-M. Guerry’s Moral Statistics of France: Challenges for Multivariable Spatial Analysis. Statistical Science, 22, 368-399. \n",
      "\n",
      "Friendly, M. (2007). Data from A.-M. Guerry, Essay on the Moral Statistics of France (1833). \n",
      "See Also\n",
      "\n",
      "The Guerry package for maps of France: gfrance and related data. \n",
      "\n",
      "Prepared by Center for Spatial Data Science. Last updated July 3, 2017. Data provided “as is,” no warranties.\n",
      "\n",
      "\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "libpysal.examples.explain('guerry')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/home/jovyan/pysal_data/guerry/Guerry.geojson'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "libpysal.examples.get_path('Guerry.geojson')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "south\n",
      "=====\n",
      "\n",
      "Homicides and selected socio-economic characteristics for Southern U.S. counties.\n",
      "---------------------------------------------------------------------------------\n",
      "\n",
      "- Observations = 1,412\n",
      "- Variables = 69\n",
      "- Years = 1960-90s\n",
      "- Support = polygon\n",
      "\n",
      "Files\n",
      "-----\n",
      "south.gdb     README.md  south.dbf      south.gpkg  south.kml  south.mif  south.shp  south.sqlite\n",
      "codebook.pdf  south.csv  south.geojson  south.html  south.mid  south.prj  south.shx  south.xlsx\n",
      "\n",
      "Variables\n",
      "---------\n",
      "NAME \tcounty name\n",
      "STATE_NAME \tstate name\n",
      "STATE_FIPS \tstate fips code (character)\n",
      "CNTY_FIPS \tcounty fips code (character)\n",
      "FIPS \tcombined state and county fips code (character)\n",
      "STFIPS \tstate fips code (numeric)\n",
      "COFIPS \tcounty fips code (numeric)\n",
      "FIPSNO \tfips code as numeric variable\n",
      "SOUTH \tdummy variable for Southern counties (South = 1)\n",
      "HR** \thomicide rate per 100,000 (1960, 1970, 1980, 1990)\n",
      "HC** \thomicide count, three year average centered on 1960, 1970, 1980, 1990\n",
      "PO** \tcounty population, 1960, 1970, 1980, 1990\n",
      "RD** \tresource deprivation 1960, 1970, 1980, 1990 (principal component, see Codebook for details)\n",
      "PS** \tpopulation structure 1960, 1970, 1980, 1990 (principal component, see Codebook for details)\n",
      "UE** \tunemployment rate 1960, 1970, 1980, 1990\n",
      "DV** \tdivorce rate 1960, 1970, 1980, 1990 (% males over 14 divorced)\n",
      "MA** \tmedian age 1960, 1970, 1980, 1990\n",
      "POL** \tlog of population 1960, 1970, 1980, 1990\n",
      "DNL** \tlog of population density 1960, 1970, 1980, 1990\n",
      "MFIL** \tlog of median family income 1960, 1970, 1980, 1990\n",
      "FP** \t% families below poverty 1960, 1970, 1980, 1990 (see Codebook for details)\n",
      "BLK** \t% black 1960, 1970, 1980, 1990\n",
      "GI** \tGini index of family income inequality 1960, 1970, 1980, 1990\n",
      "FH** \t% female headed households 1960, 1970, 1980, 1990\n",
      "\n"
     ]
    }
   ],
   "source": [
    "libpysal.examples.explain('south')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/home/jovyan/pysal_data/south/south.shp'"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "libpysal.examples.get_path('south.shp')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "missing.shp not found.\n"
     ]
    }
   ],
   "source": [
    "libpysal.examples.get_path('missing.shp')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "pth = libpysal.examples.get_path('south.shp')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/home/jovyan/pysal_data/south/south.shp'"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pth"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "import geopandas as gpd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = gpd.read_file(pth)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>NAME</th>\n",
       "      <th>STATE_NAME</th>\n",
       "      <th>STATE_FIPS</th>\n",
       "      <th>CNTY_FIPS</th>\n",
       "      <th>FIPS</th>\n",
       "      <th>STFIPS</th>\n",
       "      <th>COFIPS</th>\n",
       "      <th>FIPSNO</th>\n",
       "      <th>SOUTH</th>\n",
       "      <th>HR60</th>\n",
       "      <th>...</th>\n",
       "      <th>BLK90</th>\n",
       "      <th>GI59</th>\n",
       "      <th>GI69</th>\n",
       "      <th>GI79</th>\n",
       "      <th>GI89</th>\n",
       "      <th>FH60</th>\n",
       "      <th>FH70</th>\n",
       "      <th>FH80</th>\n",
       "      <th>FH90</th>\n",
       "      <th>geometry</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Hancock</td>\n",
       "      <td>West Virginia</td>\n",
       "      <td>54</td>\n",
       "      <td>029</td>\n",
       "      <td>54029</td>\n",
       "      <td>54</td>\n",
       "      <td>29</td>\n",
       "      <td>54029</td>\n",
       "      <td>1</td>\n",
       "      <td>1.682864</td>\n",
       "      <td>...</td>\n",
       "      <td>2.557262</td>\n",
       "      <td>0.223645</td>\n",
       "      <td>0.295377</td>\n",
       "      <td>0.332251</td>\n",
       "      <td>0.363934</td>\n",
       "      <td>9.981297</td>\n",
       "      <td>7.8</td>\n",
       "      <td>9.785797</td>\n",
       "      <td>12.604552</td>\n",
       "      <td>POLYGON ((-80.6280517578125 40.39815902709961,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Brooke</td>\n",
       "      <td>West Virginia</td>\n",
       "      <td>54</td>\n",
       "      <td>009</td>\n",
       "      <td>54009</td>\n",
       "      <td>54</td>\n",
       "      <td>9</td>\n",
       "      <td>54009</td>\n",
       "      <td>1</td>\n",
       "      <td>4.607233</td>\n",
       "      <td>...</td>\n",
       "      <td>0.748370</td>\n",
       "      <td>0.220407</td>\n",
       "      <td>0.318453</td>\n",
       "      <td>0.314165</td>\n",
       "      <td>0.350569</td>\n",
       "      <td>10.929337</td>\n",
       "      <td>8.0</td>\n",
       "      <td>10.214990</td>\n",
       "      <td>11.242293</td>\n",
       "      <td>POLYGON ((-80.52625274658203 40.16244888305664...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Ohio</td>\n",
       "      <td>West Virginia</td>\n",
       "      <td>54</td>\n",
       "      <td>069</td>\n",
       "      <td>54069</td>\n",
       "      <td>54</td>\n",
       "      <td>69</td>\n",
       "      <td>54069</td>\n",
       "      <td>1</td>\n",
       "      <td>0.974132</td>\n",
       "      <td>...</td>\n",
       "      <td>3.310334</td>\n",
       "      <td>0.272398</td>\n",
       "      <td>0.358454</td>\n",
       "      <td>0.376963</td>\n",
       "      <td>0.390534</td>\n",
       "      <td>15.621643</td>\n",
       "      <td>12.9</td>\n",
       "      <td>14.716681</td>\n",
       "      <td>17.574021</td>\n",
       "      <td>POLYGON ((-80.52516937255859 40.02275085449219...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Marshall</td>\n",
       "      <td>West Virginia</td>\n",
       "      <td>54</td>\n",
       "      <td>051</td>\n",
       "      <td>54051</td>\n",
       "      <td>54</td>\n",
       "      <td>51</td>\n",
       "      <td>54051</td>\n",
       "      <td>1</td>\n",
       "      <td>0.876248</td>\n",
       "      <td>...</td>\n",
       "      <td>0.546097</td>\n",
       "      <td>0.227647</td>\n",
       "      <td>0.319580</td>\n",
       "      <td>0.320953</td>\n",
       "      <td>0.377346</td>\n",
       "      <td>11.962834</td>\n",
       "      <td>8.8</td>\n",
       "      <td>8.803253</td>\n",
       "      <td>13.564159</td>\n",
       "      <td>POLYGON ((-80.52446746826172 39.72112655639648...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>New Castle</td>\n",
       "      <td>Delaware</td>\n",
       "      <td>10</td>\n",
       "      <td>003</td>\n",
       "      <td>10003</td>\n",
       "      <td>10</td>\n",
       "      <td>3</td>\n",
       "      <td>10003</td>\n",
       "      <td>1</td>\n",
       "      <td>4.228385</td>\n",
       "      <td>...</td>\n",
       "      <td>16.480294</td>\n",
       "      <td>0.256106</td>\n",
       "      <td>0.329678</td>\n",
       "      <td>0.365830</td>\n",
       "      <td>0.332703</td>\n",
       "      <td>12.035714</td>\n",
       "      <td>10.7</td>\n",
       "      <td>15.169480</td>\n",
       "      <td>16.380903</td>\n",
       "      <td>POLYGON ((-75.77269744873047 39.38300704956055...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 70 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         NAME     STATE_NAME STATE_FIPS CNTY_FIPS   FIPS  STFIPS  COFIPS  \\\n",
       "0     Hancock  West Virginia         54       029  54029      54      29   \n",
       "1      Brooke  West Virginia         54       009  54009      54       9   \n",
       "2        Ohio  West Virginia         54       069  54069      54      69   \n",
       "3    Marshall  West Virginia         54       051  54051      54      51   \n",
       "4  New Castle       Delaware         10       003  10003      10       3   \n",
       "\n",
       "   FIPSNO  SOUTH      HR60  ...      BLK90      GI59      GI69      GI79  \\\n",
       "0   54029      1  1.682864  ...   2.557262  0.223645  0.295377  0.332251   \n",
       "1   54009      1  4.607233  ...   0.748370  0.220407  0.318453  0.314165   \n",
       "2   54069      1  0.974132  ...   3.310334  0.272398  0.358454  0.376963   \n",
       "3   54051      1  0.876248  ...   0.546097  0.227647  0.319580  0.320953   \n",
       "4   10003      1  4.228385  ...  16.480294  0.256106  0.329678  0.365830   \n",
       "\n",
       "       GI89       FH60  FH70       FH80       FH90  \\\n",
       "0  0.363934   9.981297   7.8   9.785797  12.604552   \n",
       "1  0.350569  10.929337   8.0  10.214990  11.242293   \n",
       "2  0.390534  15.621643  12.9  14.716681  17.574021   \n",
       "3  0.377346  11.962834   8.8   8.803253  13.564159   \n",
       "4  0.332703  12.035714  10.7  15.169480  16.380903   \n",
       "\n",
       "                                            geometry  \n",
       "0  POLYGON ((-80.6280517578125 40.39815902709961,...  \n",
       "1  POLYGON ((-80.52625274658203 40.16244888305664...  \n",
       "2  POLYGON ((-80.52516937255859 40.02275085449219...  \n",
       "3  POLYGON ((-80.52446746826172 39.72112655639648...  \n",
       "4  POLYGON ((-75.77269744873047 39.38300704956055...  \n",
       "\n",
       "[5 rows x 70 columns]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "from libpysal.examples.sacramento2 import fetch_sacramento2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "already exists, not downloading\n"
     ]
    }
   ],
   "source": [
    "fetch_sacramento2()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "sacramento2\n",
      "===========\n",
      "\n",
      "2000 Census Tract Data for Sacramento MSA\n",
      "-----------------------------------------\n",
      "\n",
      "- Observations = 83\n",
      "- Variables = 66\n",
      "- Years = 1998, 2001\n",
      "- Support = polygon\n",
      "\n",
      "Files\n",
      "-----\n",
      " SacramentoMSA2.gdb       SacramentoMSA2.kml   SacramentoMSA2.shp\n",
      " README.md                SacramentoMSA2.mid   SacramentoMSA2.shx\n",
      " SacramentoMSA2.csv       SacramentoMSA2.mif   SacramentoMSA2.sqlite\n",
      " SacramentoMSA2.dbf       SacramentoMSA2.prj   SacramentoMSA2.xlsx\n",
      " SacramentoMSA2.geojson   SacramentoMSA2.sbn  'Variable Info for Zip Code File.pdf'\n",
      " SacramentoMSA2.gpkg      SacramentoMSA2.sbx\n",
      "\n",
      "Variables\n",
      "---------\n",
      "ZIP ZIP code\n",
      "PO_NAME \tName of ZIP code area\n",
      "STATE \tSTATE\n",
      "MSA \tMSA\n",
      "CBSA_CODE \tCBSA code\n",
      "MAN98 \t1998 total manufacturing establishments (MSA)\n",
      "MAN98_12 \t1998 total manufacturing establishments, 1-9 employees (MSA)\n",
      "MAN98_39 \t1998 total manufacturing establishments 10+ employees (MSA)\n",
      "MAN01 \t2001 total manufacturing establishments (MSA)\n",
      "MAN01_12 \t2001 total manufacturing establishments, 1-9 employees (MSA)\n",
      "MAN01_39 \t2001 total manufacturing establishments, 10+ employees (MSA)\n",
      "MAN98US \t1998 total manufacturing establishments (US)\n",
      "MAN98US12 \t1998 total manufacturing establishments, 1-9 employees (US)\n",
      "MAN98US39 \t1998 total manufacturing establishments 10+ employees (US)\n",
      "MAN01US \t2001 total manufacturing establishments (US)\n",
      "MAN01US_12 \t2001 total manufacturing establishments, 1-9 employees (US)\n",
      "MAN01US_39 \t2001 total manufacturing establishments, 10+ employees (US)\n",
      "OFF98 \t1998 total office establishments (MSA)\n",
      "OFF98_12 \t1998 total office establishments, 1-9 employees (MSA)\n",
      "OFF98_39 \t1998 total office establishments, 10+ employees (MSA)\n",
      "OFF01 \t2001 total office establishments (MSA)\n",
      "OFF01_12 \t2001 total office establishments, 1-9 employees (MSA)\n",
      "OFF01_39 \t2001 total office establishments, 10+ employees (MSA)\n",
      "OFF98US \t1998 total office establishments (US)\n",
      "OFF98US12 \t1998 total office establishments, 1-9 employees (US)\n",
      "OFF98US39 \t1998 total office establishments, 10+ employees (US)\n",
      "OFF01US \t2001 total office establishments (US)\n",
      "OFFUS01_12 \t2001 total office establishments, 1-9 employees (US)\n",
      "OFFUS01_39 \t2001 total office establishments, 10+ employees (US)\n",
      "INFO98 \t1998 total information establishments (MSA)\n",
      "INFO98_12 \t1998 total information establishments, 1-9 employees (MSA)\n",
      "INFO98_39 \t1998 total information establishments, 10+ employees (MSA)\n",
      "INFO01 \t2001 total information establishments (MSA)\n",
      "INFO01_12 \t2001 total information establishments, 1-9 employees (MSA)\n",
      "INFO01_39 \t2001 total information establishments, 10+ employees (MSA)\n",
      "INFO98US \t1998 total information establishments (US)\n",
      "INFO98US12 \t1998 total information establishments, 1-9 employees (US)\n",
      "INFO98US39 \t1998 total information establishments, 10+ employees (US)\n",
      "INFO01US \t2001 total information establishments (US)\n",
      "INFO01US_1 \t2001 total information establishments, 1-9 employees (US)\n",
      "INFO01US_3 \t2001 total information establishments, 10+ employees (US)\n",
      "INDEX \tIndex\n",
      "NUMSEC \tNumber of sectors represented in ZIP code\n",
      "EST98 \tTotal establishments in ZIP code, 1998\n",
      "EST01 \tTotal establishments in ZIP code, 2001\n",
      "PCTNGE \tNational growth effect, percent (N)\n",
      "PCTIME \tIndustry mix effect, percent (M)\n",
      "PCTCSE \tCompetitive shift effect, percent (S)\n",
      "PCTGRO \tPercent growth establishments, 1998-2001 (R)\n",
      "ID \tUnique ZIP code ID for ID variables in weights matrix creation window\n",
      "\n",
      "Source: US Census Bureau, 2000 Census (Summary File 3). Extracted from http://factfinder.census.gov in April 2004.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "libpysal.examples.explain('sacramento2')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/home/jovyan/libpysal/examples/10740/10740.shx'"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "libpysal.examples.get_path(\"10740.shx\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "from libpysal.examples.nyc_bikes import fetch_bikes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "already exists, not downloading\n"
     ]
    }
   ],
   "source": [
    "fetch_bikes()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/home/jovyan/pysal_data/nyc_bikes/nyct2010.shp'"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "libpysal.examples.get_path('nyct2010.shp')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "already exists, not downloading\n"
     ]
    }
   ],
   "source": [
    "from libpysal.examples.rio_grande_do_sul import fetch_rio\n",
    "fetch_rio()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/home/jovyan/pysal_data/rio_grande_do_sul/map_RS_BR.shp'"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "libpysal.examples.get_path('map_RS_BR.shp')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from libpysal.examples.taz import fetch_taz\n",
    "fetch_taz()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "libpysal.examples.get_path('taz.dbf')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
