Files on this page are licensed under a GNU General Public License and are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This Python 3.x script was written as a function to geocode delimited text files of parsed or un-parsed US addresses using the US Census Geocoder API. It relies on the external censusgeocode module which must be downloaded and installed in advance, as well as several internal Python modules. For best results, input text files should be encoded as UTF-8. After loading the function, it can be called to process a file with the following parameters:


ParametersExample 1Example 2



census_geocode('my_addresses.txt','\t','n',0,[2,3,4,5])census_geocode('C:\data\addresses.csv', ',', 'y',0,[3])
(str,str,str,int,list[int]) -> filesFile is: stored in same directory as the script, is tab-delimited, has no header, start reading at the beginning, address, city, state, and ZIP are stored in columns 2 through 5.File is: stored in an absolute location, is comma-delimited, has a header, start reading at the beginning, un-parsed address is stored in the 3rd column.


Also available on github

May 2016geocode_census_funct.zipPython 3.x script with documentation for batch geocoding text files of US addresses

The creator, Baruch College, and CUNY disclaim any liability for errors, inaccuracies, or omissions that may be contained within these resources and for any damages that may arise from the foregoing. Users should independently verify the accuracy of the materials for their own purposes.


#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels