Skip to main content

Geocoding api extract to dataframe script.

Project description

geocoding-api-extract

This package makes it easy to connect to the US GeoCoding api and extract data from a large set of addresses. It batches up the request for querying the api and returns the results in a Pandas DataFrame as a result. The US geocoding api does accept batches but it does not work unless you have more address details like zipcode. This script allows you to look up address details using only street address, city, and state.

Install

pip install geocoding_api_extract

Usage

The following code will retrieve a DataFrame with the following columns: ['address', 'state', 'county', 'tract', 'cent_lat', 'cent_lon','us_zip'].

import geocoding_api_extract as geox

tmp_folder = "tmp"

addr_data = {'address': ['6021 CERVINUS RUN', "4008 VIVAS LN", "7612 CAYENNE LN"],
             'city': 'Austin',
             'state': 'TX'}

result = geox.extract_address_details(addr_data['address'], addr_data['city'], addr_data['state'],
                                      tmp_folder)

geox.remove_tmp_files('Austin', 'TX', 'tmp')

I have also included a larger sample to try this out in the 'sample_data' folder.

import pandas as pd

import geocoding_api_extract as geox

tmp_folder = "tmp"

df = pd.read_parquet('sample_data/addresses_sample.parquet.gzip')

addresses = df['address']
city = 'Austin'
state = 'TX'

result = geox.extract_address_details(addresses, city, state,
                                      tmp_folder)

geox.remove_tmp_files('Austin', 'TX', 'tmp')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geocoding_api_extract-0.0.2.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

geocoding_api_extract-0.0.2-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page