How to use the censusdata.exportcsv function in CensusData

To help you get started, we’ve selected a few CensusData examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jtleider / censusdata / test / test_export.py View on Github external
def test_export(self):
		data = censusdata.download('acs5', 2015, censusdata.censusgeo([('state', '*')]), ['B01001_001E'])
		try:
			csv = StringIO.StringIO()
		except NameError:
			csv = io.StringIO()
		censusdata.exportcsv(csv, data)
		self.maxDiff = None
		self.assertEqual(csv.getvalue(), textwrap.dedent("""\
		state,NAME,B01001_001E
		01,Alabama,4830620
		02,Alaska,733375
		04,Arizona,6641928
		05,Arkansas,2958208
		06,California,38421464
		08,Colorado,5278906
		09,Connecticut,3593222
		10,Delaware,926454
		11,District of Columbia,647484
		12,Florida,19645772
		13,Georgia,10006693
		15,Hawaii,1406299
		16,Idaho,1616547

CensusData

Download data from U.S. Census API

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis