Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,37 +1,9 @@
|
|
1 |
#import definitions
|
2 |
import pandas as pdb
|
3 |
-
from typing import NamedTuple, Dict
|
4 |
|
|
|
|
|
5 |
|
6 |
-
class ZipCodeEntry(NamedTuple):
|
7 |
-
zip: str
|
8 |
-
city: str
|
9 |
-
state: str
|
10 |
-
lat: str
|
11 |
-
long: str
|
12 |
|
13 |
|
14 |
-
def _load_zip_codes() -> Dict[str, ZipCodeEntry]:
|
15 |
-
df = pdb.read_csv('Map-City-State-Zip-Lat-Long.txt', dtype=str,sep=';')
|
16 |
-
zip_code_list = {}
|
17 |
-
# Zip;City;State;Latitude;Longitude;Timezone;
|
18 |
-
for _, row in df.iterrows():
|
19 |
-
zip_code = row.get('Zip')
|
20 |
-
if zip_code:
|
21 |
-
zip_code_entry = ZipCodeEntry(
|
22 |
-
zip=zip_code,
|
23 |
-
city=row.get('City'),
|
24 |
-
state=row.get('State'),
|
25 |
-
lat=row.get('Latitude'),
|
26 |
-
long=row.get('Longitude'))
|
27 |
-
zip_code_list[zip_code] = zip_code_entry
|
28 |
|
29 |
-
return zip_code_list
|
30 |
-
|
31 |
-
|
32 |
-
ZIP_CODE_LIST = _load_zip_codes()
|
33 |
-
|
34 |
-
|
35 |
-
if __name__ == '__main__':
|
36 |
-
print(ZIP_CODE_LIST)
|
37 |
-
print(ZIP_CODE_LIST.get('62833'))
|
|
|
1 |
#import definitions
|
2 |
import pandas as pdb
|
|
|
3 |
|
4 |
+
df = pd.read_csv('Map-City-State-Zip-Lat-Long.txt', dtype_str, sep=';')
|
5 |
+
st.print(df)
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|