zipcode-features 0.0.6__tar.gz → 0.0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {zipcode_features-0.0.6/zipcode_features.egg-info → zipcode_features-0.0.8}/PKG-INFO +11 -26
- zipcode_features-0.0.8/azure-pipelines.yml +57 -0
- zipcode_features-0.0.8/clean_install.sh +5 -0
- zipcode_features-0.0.8/pyproject.toml +37 -0
- zipcode_features-0.0.8/requirements.txt +56 -0
- {zipcode_features-0.0.6 → zipcode_features-0.0.8}/setup.py +2 -7
- {zipcode_features-0.0.6 → zipcode_features-0.0.8/src}/zipcode_features/__init__.py +11 -7
- zipcode_features-0.0.8/src/zipcode_features/data/CBSA_ZIP_122025.csv +47635 -0
- zipcode_features-0.0.8/src/zipcode_features/data/ZIP_COUNTY_122025.csv +54572 -0
- zipcode_features-0.0.8/src/zipcode_features/data/bls_2025_quarter_four.csv +19303 -0
- zipcode_features-0.0.8/src/zipcode_features/data/bls_2025_quarter_one.csv +19303 -0
- zipcode_features-0.0.8/src/zipcode_features/data/bls_2025_quarter_three.csv +19303 -0
- zipcode_features-0.0.8/src/zipcode_features/data/bls_2025_quarter_two.csv +19303 -0
- zipcode_features-0.0.8/src/zipcode_features/data/cbsa_codes.json +270 -0
- zipcode_features-0.0.8/uv.lock +771 -0
- zipcode_features-0.0.6/PKG-INFO +0 -204
- zipcode_features-0.0.6/setup.cfg +0 -4
- zipcode_features-0.0.6/zipcode_features.egg-info/SOURCES.txt +0 -9
- zipcode_features-0.0.6/zipcode_features.egg-info/dependency_links.txt +0 -1
- zipcode_features-0.0.6/zipcode_features.egg-info/requires.txt +0 -4
- zipcode_features-0.0.6/zipcode_features.egg-info/top_level.txt +0 -1
- {zipcode_features-0.0.6 → zipcode_features-0.0.8}/LICENSE +0 -0
- {zipcode_features-0.0.6 → zipcode_features-0.0.8}/README.md +0 -0
|
@@ -1,35 +1,20 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.0.
|
|
4
|
-
Summary: A
|
|
5
|
-
|
|
6
|
-
Author: Eric Schles
|
|
7
|
-
Author-email: ericschles@gmail.com
|
|
2
|
+
Name: zipcode-features
|
|
3
|
+
Version: 0.0.8
|
|
4
|
+
Summary: A Python package to process and extract features from zipcode data.
|
|
5
|
+
Project-URL: Homepage, https://github.com/EricSchles/zipcode_features
|
|
6
|
+
Author-email: Eric Schles <your.email@example.com>
|
|
8
7
|
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
10
11
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
License-File: LICENSE
|
|
19
|
-
Requires-Dist: zipcodes
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Requires-Dist: numpy<=2.3.5
|
|
20
14
|
Requires-Dist: pandas
|
|
21
15
|
Requires-Dist: zipcode3==1.0.3
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
|
|
24
|
-
Dynamic: author-email
|
|
25
|
-
Dynamic: classifier
|
|
26
|
-
Dynamic: description
|
|
27
|
-
Dynamic: description-content-type
|
|
28
|
-
Dynamic: home-page
|
|
29
|
-
Dynamic: license
|
|
30
|
-
Dynamic: license-file
|
|
31
|
-
Dynamic: requires-dist
|
|
32
|
-
Dynamic: summary
|
|
16
|
+
Requires-Dist: zipcodes
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
33
18
|
|
|
34
19
|
# zipcode features
|
|
35
20
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Python package
|
|
2
|
+
# Create and test a Python package on multiple Python versions.
|
|
3
|
+
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
|
|
4
|
+
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
|
|
5
|
+
|
|
6
|
+
trigger:
|
|
7
|
+
- master
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
|
|
11
|
+
- job: 'Test'
|
|
12
|
+
pool:
|
|
13
|
+
vmImage: 'Ubuntu-16.04'
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
Python36:
|
|
17
|
+
python.version: '3.10'
|
|
18
|
+
Python37:
|
|
19
|
+
python.version: '3.11'
|
|
20
|
+
maxParallel: 4
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- task: UsePythonVersion@0
|
|
24
|
+
inputs:
|
|
25
|
+
versionSpec: '$(python.version)'
|
|
26
|
+
architecture: 'x64'
|
|
27
|
+
|
|
28
|
+
- script: python -m pip install --upgrade pip && pip install -r requirements.txt
|
|
29
|
+
displayName: 'Install dependencies'
|
|
30
|
+
|
|
31
|
+
- script: python setup.py install
|
|
32
|
+
displayName: 'Install library'
|
|
33
|
+
|
|
34
|
+
- script: |
|
|
35
|
+
pip install pytest
|
|
36
|
+
pytest tests --doctest-modules --junitxml=junit/test-results.xml
|
|
37
|
+
displayName: 'pytest'
|
|
38
|
+
|
|
39
|
+
- task: PublishTestResults@2
|
|
40
|
+
inputs:
|
|
41
|
+
testResultsFiles: '**/test-results.xml'
|
|
42
|
+
testRunTitle: 'Python $(python.version)'
|
|
43
|
+
condition: succeededOrFailed()
|
|
44
|
+
|
|
45
|
+
- job: 'Publish'
|
|
46
|
+
dependsOn: 'Test'
|
|
47
|
+
pool:
|
|
48
|
+
vmImage: 'Ubuntu-16.04'
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- task: UsePythonVersion@0
|
|
52
|
+
inputs:
|
|
53
|
+
versionSpec: '3.x'
|
|
54
|
+
architecture: 'x64'
|
|
55
|
+
|
|
56
|
+
- script: python setup.py sdist
|
|
57
|
+
displayName: 'Build sdist'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
# Tells uv or pip what engine to use to build the package wheel
|
|
3
|
+
requires = ["hatchling"]
|
|
4
|
+
build-backend = "hatchling.build"
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "zipcode-features"
|
|
8
|
+
version = "0.0.8"
|
|
9
|
+
description = "A Python package to process and extract features from zipcode data."
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
license = { text = "MIT" }
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Eric Schles", email = "your.email@example.com" }
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
# Add your runtime dependencies here (e.g., pandas, polars, feast, etc.)
|
|
23
|
+
"zipcodes",
|
|
24
|
+
"pandas",
|
|
25
|
+
"numpy<=2.3.5",
|
|
26
|
+
"zipcode3==1.0.3",
|
|
27
|
+
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/EricSchles/zipcode_features"
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.wheel]
|
|
34
|
+
packages = ["src/zipcode_features"]
|
|
35
|
+
|
|
36
|
+
#[tool.hatch.build.targets.wheel.force-include]
|
|
37
|
+
#"src/zipcode_features/data" = "zipcode_features/data"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# This file was autogenerated by uv via the following command:
|
|
2
|
+
# uv pip compile pyproject.toml -o requirements.txt
|
|
3
|
+
atomicwrites==1.4.1
|
|
4
|
+
# via zipcode3
|
|
5
|
+
attrs==26.1.0
|
|
6
|
+
# via zipcode3
|
|
7
|
+
botocore==1.43.39
|
|
8
|
+
# via zipcode3
|
|
9
|
+
certifi==2026.6.17
|
|
10
|
+
# via requests
|
|
11
|
+
charset-normalizer==3.4.7
|
|
12
|
+
# via requests
|
|
13
|
+
fuzzywuzzy==0.18.0
|
|
14
|
+
# via zipcode3
|
|
15
|
+
haversine==2.9.0
|
|
16
|
+
# via zipcode3
|
|
17
|
+
idna==3.18
|
|
18
|
+
# via requests
|
|
19
|
+
jmespath==1.1.0
|
|
20
|
+
# via botocore
|
|
21
|
+
numpy==2.3.5
|
|
22
|
+
# via
|
|
23
|
+
# zipcode-features (pyproject.toml)
|
|
24
|
+
# pandas
|
|
25
|
+
pandas==3.0.3
|
|
26
|
+
# via zipcode-features (pyproject.toml)
|
|
27
|
+
pathlib-mate==1.3.2
|
|
28
|
+
# via zipcode3
|
|
29
|
+
prettytable==3.18.0
|
|
30
|
+
# via sqlalchemy-mate
|
|
31
|
+
python-dateutil==2.9.0.post0
|
|
32
|
+
# via
|
|
33
|
+
# botocore
|
|
34
|
+
# pandas
|
|
35
|
+
requests==2.34.2
|
|
36
|
+
# via zipcode3
|
|
37
|
+
six==1.17.0
|
|
38
|
+
# via python-dateutil
|
|
39
|
+
sqlalchemy==2.0.51
|
|
40
|
+
# via
|
|
41
|
+
# sqlalchemy-mate
|
|
42
|
+
# zipcode3
|
|
43
|
+
sqlalchemy-mate==2.0.0.3
|
|
44
|
+
# via zipcode3
|
|
45
|
+
typing-extensions==4.16.0
|
|
46
|
+
# via sqlalchemy
|
|
47
|
+
urllib3==2.7.0
|
|
48
|
+
# via
|
|
49
|
+
# botocore
|
|
50
|
+
# requests
|
|
51
|
+
wcwidth==0.8.2
|
|
52
|
+
# via prettytable
|
|
53
|
+
zipcode3==1.0.3
|
|
54
|
+
# via zipcode-features (pyproject.toml)
|
|
55
|
+
zipcodes==3.0.0
|
|
56
|
+
# via zipcode-features (pyproject.toml)
|
|
@@ -10,7 +10,7 @@ README = (HERE / "README.md").read_text()
|
|
|
10
10
|
# This call to setup() does all the work
|
|
11
11
|
setup(
|
|
12
12
|
name="zipcode_features",
|
|
13
|
-
version="0.0.
|
|
13
|
+
version="0.0.4",
|
|
14
14
|
description="A tool to get features based on census data from zipcodes",
|
|
15
15
|
long_description=README,
|
|
16
16
|
long_description_content_type="text/markdown",
|
|
@@ -32,10 +32,5 @@ setup(
|
|
|
32
32
|
"zipcode_features",
|
|
33
33
|
],
|
|
34
34
|
include_package_data=True,
|
|
35
|
-
install_requires=[
|
|
36
|
-
"zipcodes",
|
|
37
|
-
"pandas",
|
|
38
|
-
"zipcode3==1.0.3",
|
|
39
|
-
"numpy<=2.3.5"
|
|
40
|
-
],
|
|
35
|
+
install_requires=["zipcodes", "pandas", "zipcode3"],
|
|
41
36
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
__version__ = '0.0.
|
|
1
|
+
__version__ = '0.0.7'
|
|
2
2
|
|
|
3
3
|
import zipcodes
|
|
4
4
|
from zipcode3.search import SearchEngine
|
|
5
|
+
from importlib import resources
|
|
5
6
|
import pandas as pd
|
|
6
7
|
import json
|
|
7
8
|
|
|
@@ -19,8 +20,8 @@ def _get_zip_to_cbsa_code() -> dict:
|
|
|
19
20
|
mapping is of the form:
|
|
20
21
|
{"zip code": "cbsa code"}
|
|
21
22
|
"""
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
with resources.path("zipcode_features.data", "CBSA_ZIP_122025.csv") as csv_path:
|
|
24
|
+
df = pd.read_csv(csv_path, dtype={'ZIP': str, "CBSA": str})
|
|
24
25
|
df["ZIP_len"] = df["ZIP"].apply(lambda x: len(x))
|
|
25
26
|
df["ZIP"] = df.apply(zipcode_mapper, axis=1)
|
|
26
27
|
return df[["ZIP", "CBSA"]].to_dict()
|
|
@@ -30,7 +31,8 @@ def _get_cbsa_code_to_cbsa_name() -> dict:
|
|
|
30
31
|
This method gets a mapping from cbsa code to name
|
|
31
32
|
{cbsa code: cbsa name}
|
|
32
33
|
"""
|
|
33
|
-
|
|
34
|
+
with resources.path("zipcode_features.data", "cbsa_codes.json") as json_path:
|
|
35
|
+
code_to_name = json.load(open(json_path))
|
|
34
36
|
df = pd.DataFrame(columns=["code", "name"])
|
|
35
37
|
df["name"] = code_to_name.values()
|
|
36
38
|
df["code"] = code_to_name.keys()
|
|
@@ -74,9 +76,11 @@ def us_get_demographics(state: str, city: str = None, zip_list: list = None) ->
|
|
|
74
76
|
else:
|
|
75
77
|
zipcode_and_demo = zip_list[:]
|
|
76
78
|
demographics = []
|
|
77
|
-
for
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
for info in zipcode_and_demo:
|
|
80
|
+
if info[1] is None:
|
|
81
|
+
continue
|
|
82
|
+
tmp_dict = info[1].to_dict()
|
|
83
|
+
tmp_dict["zip_code"] = info[0]
|
|
80
84
|
demographics.append(tmp_dict)
|
|
81
85
|
df = pd.DataFrame(demographics)
|
|
82
86
|
zip_to_cbsa = _get_zip_to_cbsa_code()
|