zipcode-features 0.0.1__py3-none-any.whl
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.
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
__version__ = '0.0.1'
|
|
2
|
+
|
|
3
|
+
import zipcodes
|
|
4
|
+
from uszipcode.search import SearchEngine
|
|
5
|
+
import pandas as pd
|
|
6
|
+
|
|
7
|
+
def us_get_demographics(state: str, city: str = None, zip_list: list = None) -> pd.DataFrame:
|
|
8
|
+
"""
|
|
9
|
+
This gets demographic information for associated with zipcodes in the United States of America.
|
|
10
|
+
|
|
11
|
+
Parameters
|
|
12
|
+
----------
|
|
13
|
+
* state : str - the US state
|
|
14
|
+
* city : str [Optional] - the US city
|
|
15
|
+
* zip_list : list [Optional] - a zip list is the query results from the zipcodes library.
|
|
16
|
+
Found here: https://github.com/seanpianka/zipcodes
|
|
17
|
+
If you use zip_list state and city will be ignored.
|
|
18
|
+
|
|
19
|
+
Returns
|
|
20
|
+
-------
|
|
21
|
+
A pandas dataframe with zipcode and everything typically returned by
|
|
22
|
+
https://github.com/EricSchles/uszipcode-project
|
|
23
|
+
"""
|
|
24
|
+
search = SearchEngine()
|
|
25
|
+
payload = {
|
|
26
|
+
"state": state,
|
|
27
|
+
"city": city
|
|
28
|
+
}
|
|
29
|
+
if zip_list is None:
|
|
30
|
+
zipcode_and_demo = [
|
|
31
|
+
[zipcode["zip_code"], search.by_zipcode(zipcode["zip_code"])]
|
|
32
|
+
for zipcode in zipcodes.filter_by(**payload)
|
|
33
|
+
]
|
|
34
|
+
else:
|
|
35
|
+
zipcode_and_demo = zip_list[:]
|
|
36
|
+
demographics = []
|
|
37
|
+
for index in range(len(zipcode_and_demo)):
|
|
38
|
+
tmp_dict = zipcode_and_demo[index][1].to_dict()
|
|
39
|
+
tmp_dict["zip_code"] = zipcode_and_demo[index][0]
|
|
40
|
+
demographics.append(tmp_dict)
|
|
41
|
+
return pd.DataFrame(demographics)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: zipcode_features
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A tool to get features based on census data from zipcodes
|
|
5
|
+
Home-page: https://github.com/EricSchles/zipcode_features
|
|
6
|
+
Author: Eric Schles
|
|
7
|
+
Author-email: ericschles@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
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
|
|
20
|
+
Requires-Dist: pandas
|
|
21
|
+
Dynamic: author
|
|
22
|
+
Dynamic: author-email
|
|
23
|
+
Dynamic: classifier
|
|
24
|
+
Dynamic: description
|
|
25
|
+
Dynamic: description-content-type
|
|
26
|
+
Dynamic: home-page
|
|
27
|
+
Dynamic: license
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: summary
|
|
31
|
+
|
|
32
|
+
# zipcode features
|
|
33
|
+
|
|
34
|
+
similar to [uszipcode-project](https://github.com/EricSchles/uszipcode-project)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
zipcode_features/__init__.py,sha256=GUKDHZRe7xmU_Bwx9S_sXcjy1aEGSPs57t81oGuhnUM,1371
|
|
2
|
+
zipcode_features-0.0.1.dist-info/licenses/LICENSE,sha256=HDbMJ7oItmxTn3jVtZFi6jUFAHovset5jzAPUderjOc,1073
|
|
3
|
+
zipcode_features-0.0.1.dist-info/METADATA,sha256=2diJ-23lvr-oXqKzuJPbBCMXXgZ6ny-HiIM_PKlUdRg,1074
|
|
4
|
+
zipcode_features-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
zipcode_features-0.0.1.dist-info/top_level.txt,sha256=ijGAxdXHaO43tVlCj3Kn05dj-hkXAv1pXBEq1Yj8mt0,17
|
|
6
|
+
zipcode_features-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2021 The Python Packaging Authority
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
zipcode_features
|