In [40]:
myKey = None

In [36]:
import requests
import pandas as pd

In [41]:
from census import Census
c = Census(myKey)

In [3]:
from us import states

In [ ]:
#2012 Survey of Business Owners: Company Summary

In [42]:
c.acs5.get(('NAME','B01001_012E'),
           {'for':'state:37'}
          )


Out[42]:
[{u'B01001_012E': 311582.0, u'NAME': 'North Carolina', u'state': '37'}]

In [30]:
c.acs5.get(('NAME', 'B01001_012E'),
          {'for': 'state:32'})


Out[30]:
[{u'B01001_012E': 101626.0, u'NAME': 'Nevada', u'state': '32'}]

In [32]:
c.acs5.dataset


Out[32]:
'acs5'

In [38]:
variables = ('NAME', 'B19001_001E')
params = {'for':'tract:*', 'in':'state:37'}
response = c.acs5.get(variables, params)
response = pd.DataFrame(response)
response.dtypes


Out[38]:
B19001_001E    float64
NAME            object
county          object
state           object
tract           object
dtype: object

In [39]:
response.head()


Out[39]:
B19001_001E NAME county state tract
0 1921.0 Census Tract 201, Alamance County, North Carolina 001 37 020100
1 1571.0 Census Tract 202, Alamance County, North Carolina 001 37 020200
2 2804.0 Census Tract 203, Alamance County, North Carolina 001 37 020300
3 2258.0 Census Tract 204, Alamance County, North Carolina 001 37 020400
4 1543.0 Census Tract 205.01, Alamance County, North Ca... 001 37 020501