"\u001b[K |████████████████████████████████| 26.6 MB 5.5 MB/s eta 0:00:01\n",
"\u001b[?25hRequirement already satisfied: pandas in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from censusdata) (1.3.4)\n",
"Requirement already satisfied: requests in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from censusdata) (2.27.1)\n",
"Requirement already satisfied: python-dateutil>=2.7.3 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from pandas->censusdata) (2.8.2)\n",
"Requirement already satisfied: pytz>=2017.3 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from pandas->censusdata) (2021.3)\n",
"Requirement already satisfied: numpy>=1.17.3 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from pandas->censusdata) (1.20.3)\n",
"Requirement already satisfied: six>=1.5 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from python-dateutil>=2.7.3->pandas->censusdata) (1.16.0)\n",
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from requests->censusdata) (1.26.7)\n",
"Requirement already satisfied: idna<4,>=2.5 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from requests->censusdata) (3.2)\n",
"Requirement already satisfied: charset-normalizer~=2.0.0 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from requests->censusdata) (2.0.4)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from requests->censusdata) (2021.10.8)\n",
"Building wheels for collected packages: censusdata\n",
" Building wheel for censusdata (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25h Created wheel for censusdata: filename=CensusData-1.15-py3-none-any.whl size=28205534 sha256=67f5d3391f90bc0e7dba31614e537f4acd16155c871442aeb1cd9a322a4f3f14\n",
" Stored in directory: /Users/liruohong/Library/Caches/pip/wheels/f7/28/2d/3308dceb3ca282b1479585690170f0a00821d9b36cbf835159\n",
"Successfully built censusdata\n",
"Installing collected packages: censusdata\n",
"Successfully installed censusdata-1.15\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"pip install censusdata"
]
},
{
"cell_type": "markdown",
"id": "e7581483",
"metadata": {},
"source": [
"### Import libararys\n",
"Import censusdata libararys\n",
"\n",
"Import pandas libarary for data processing"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "dbda6a76",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import censusdata"
]
},
{
"cell_type": "markdown",
"id": "569bec68",
"metadata": {},
"source": [
"### Method of censusdata library\n",
"censusdata.search(src, year,field, criterion,tabletype): search for given text patterns\n",
"\n",
"censusdata.censustable():identified table of interest\n",
"\n",
"censusdata.printtable():show all variables included in the identified table of interest\n",
"\n",
"censusdata.geographies():\n",
"\n",
"censusdata.download():download the selected data"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "5b7a5a3e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[('B23024_023E',\n",
" 'POVERTY STATUS IN THE PAST 12 MONTHS BY DISABILITY STATUS BY EMPLOYMENT STATUS FOR THE POPULATION 20 TO 64 YEARS',\n",
" 'Estimate!!Total!!Income in the past 12 months at or above poverty level!!With a disability!!In labor force!!Civilian!!Unemployed'),\n",
" ('B23024_030E',\n",
" 'POVERTY STATUS IN THE PAST 12 MONTHS BY DISABILITY STATUS BY EMPLOYMENT STATUS FOR THE POPULATION 20 TO 64 YEARS',\n",
" 'Estimate!!Total!!Income in the past 12 months at or above poverty level!!No disability!!In labor force!!Civilian!!Unemployed'),\n",
" ('B23025_005E',\n",
" 'EMPLOYMENT STATUS FOR THE POPULATION 16 YEARS AND OVER',\n",
[K |████████████████████████████████| 26.6 MB 5.5 MB/s eta 0:00:01
[?25hRequirement already satisfied: pandas in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from censusdata) (1.3.4)
Requirement already satisfied: requests in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from censusdata) (2.27.1)
Requirement already satisfied: python-dateutil>=2.7.3 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from pandas->censusdata) (2.8.2)
Requirement already satisfied: pytz>=2017.3 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from pandas->censusdata) (2021.3)
Requirement already satisfied: numpy>=1.17.3 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from pandas->censusdata) (1.20.3)
Requirement already satisfied: six>=1.5 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from python-dateutil>=2.7.3->pandas->censusdata) (1.16.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from requests->censusdata) (1.26.7)
Requirement already satisfied: idna<4,>=2.5 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from requests->censusdata) (3.2)
Requirement already satisfied: charset-normalizer~=2.0.0 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from requests->censusdata) (2.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /Users/liruohong/opt/anaconda3/lib/python3.9/site-packages (from requests->censusdata) (2021.10.8)
Building wheels for collected packages: censusdata
Building wheel for censusdata (setup.py) ... [?25ldone
[?25h Created wheel for censusdata: filename=CensusData-1.15-py3-none-any.whl size=28205534 sha256=67f5d3391f90bc0e7dba31614e537f4acd16155c871442aeb1cd9a322a4f3f14
Stored in directory: /Users/liruohong/Library/Caches/pip/wheels/f7/28/2d/3308dceb3ca282b1479585690170f0a00821d9b36cbf835159
Successfully built censusdata
Installing collected packages: censusdata
Successfully installed censusdata-1.15
Note: you may need to restart the kernel to use updated packages.
%% Cell type:markdown id:e7581483 tags:
### Import libararys
Import censusdata libararys
Import pandas libarary for data processing
%% Cell type:code id:dbda6a76 tags:
``` python
importpandasaspd
importcensusdata
```
%% Cell type:markdown id:569bec68 tags:
### Method of censusdata library
censusdata.search(src, year,field, criterion,tabletype): search for given text patterns
censusdata.censustable():identified table of interest
censusdata.printtable():show all variables included in the identified table of interest