Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,8 +41,10 @@ import streamlit as st
|
|
41 |
import pandas as pd
|
42 |
import pydeck as pdk
|
43 |
|
44 |
-
def ShowCityDataframe(
|
45 |
-
df = pd.read_csv(
|
|
|
|
|
46 |
st.title("City FIPS, Location, and Population")
|
47 |
st.text("Search for any city in the United States:")
|
48 |
|
@@ -50,16 +52,18 @@ def ShowCityDataframe(DATA_URL, SEARCH_DATA):
|
|
50 |
search_query = st.text_input(label="City Name", value="")
|
51 |
if search_query != "":
|
52 |
df = df[df["city"].str.contains(search_query, case=False)]
|
53 |
-
|
|
|
|
|
54 |
# Search query for new data
|
55 |
search_query2 = st.text_input(label="Zip Code", value="")
|
56 |
if search_query2 != "":
|
57 |
-
|
|
|
|
|
58 |
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
|
63 |
-
SearchData = "US.txt"
|
64 |
-
ShowCityDataframe(Cities, SearchData)
|
65 |
|
|
|
41 |
import pandas as pd
|
42 |
import pydeck as pdk
|
43 |
|
44 |
+
def ShowCityDataframe(uscities, US):
|
45 |
+
df = pd.read_csv(uscities)
|
46 |
+
df2 = pd.read_csv(uscities)
|
47 |
+
|
48 |
st.title("City FIPS, Location, and Population")
|
49 |
st.text("Search for any city in the United States:")
|
50 |
|
|
|
52 |
search_query = st.text_input(label="City Name", value="")
|
53 |
if search_query != "":
|
54 |
df = df[df["city"].str.contains(search_query, case=False)]
|
55 |
+
st.subheader("City Detail")
|
56 |
+
st.write(df)
|
57 |
+
|
58 |
# Search query for new data
|
59 |
search_query2 = st.text_input(label="Zip Code", value="")
|
60 |
if search_query2 != "":
|
61 |
+
df2 = df2[df2["zips"].str.contains(search_query2)]
|
62 |
+
st.subheader("Zip Code Area Detail")
|
63 |
+
st.write(df2)
|
64 |
|
65 |
+
uscities = "uscities.csv" # CSV - City area latitude, longitude and polygon, along with zip list
|
66 |
+
US = "US.txt" # TSV -
|
67 |
|
68 |
+
ShowCityDataframe(uscities, US)
|
|
|
|
|
69 |
|