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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file geocoding_api_extract-0.0.2.tar.gz
.
File metadata
- Download URL: geocoding_api_extract-0.0.2.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e406a5a337b3ac5c7c5ddd7e99600b76d9e93ba556b74799157c9be8cf81813c |
|
MD5 | fabf75c96e00dc34d2db5964c98803e8 |
|
BLAKE2b-256 | 0dde0a45c6cc779461424e1ba66310cb4234b27c7ba633140a420d27976b4805 |
File details
Details for the file geocoding_api_extract-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: geocoding_api_extract-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09c1c8ce13c667cb509206008413fbe27a69447e90baaf1d06e9fdbb38d9616b |
|
MD5 | 9c6fd9b63107425708cb97427394ed73 |
|
BLAKE2b-256 | 54b12f95691370d6bdb70ce3b2d4be2de9dba9a62a640e4b9f803f5e1b4f4c2f |