Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from cmath import pi
|
2 |
from json import load, tool
|
3 |
from os import stat
|
4 |
-
from telnetlib import RCP
|
5 |
import streamlit as st
|
6 |
import pandas as pd
|
7 |
import numpy as np
|
@@ -31,19 +31,23 @@ queried_female = st.checkbox("Female",value=True)
|
|
31 |
|
32 |
@st.cache(allow_output_mutation=True)
|
33 |
def gen_load() -> pd.DataFrame:
|
34 |
-
df = my.get_data()
|
|
|
35 |
return df
|
36 |
|
|
|
|
|
37 |
@st.cache(allow_output_mutation=True)
|
38 |
def gen_load_old() -> pd.DataFrame:
|
39 |
# file = pd.read_csv('us-zip-code-latitude-and-longitude.txt',names = ['Zip','City','State','lat','lon','Timezone',"Daylight Savings", "Geo point"], skiprows=1, delimiter=";")
|
40 |
filename = "US.txt"
|
41 |
file = pd.read_csv(filename,names = ['Country','Zip','City','State','Abb','Name1','Code1','Name2','Code2','lat','lon','Accuracy'], delimiter="\t",usecols=["Zip","City","State","Abb","lat","lon"])
|
42 |
-
#file = pd.read_csv('US.txt',names = ['Country','Zip','City','State','Abb','Name1','Code1','Name2','Code2','lat','lon','Accuracy'], delimiter="\t",usecols=["Zip","City","State","Abb","lat","lon"])
|
43 |
file['Zip'] = file['Zip'].astype(str).str.zfill(5)
|
44 |
w = lambda x: (x[-5:])
|
45 |
filename = "NPIProviders.xlsx"
|
46 |
-
df = pd.
|
|
|
|
|
47 |
df = df.merge(file, left_on = 'Zip', right_on = 'Zip', how='inner')
|
48 |
df = df.fillna(" ")
|
49 |
return df
|
@@ -78,11 +82,11 @@ def load_data(state = None,zip_code = None,city = None,age = None,male = None,f
|
|
78 |
except:
|
79 |
pass
|
80 |
|
81 |
-
value_counts = df["FCName"].value_counts()
|
82 |
-
df2 = pd.DataFrame(value_counts)
|
83 |
-
df2 = df2.reset_index()
|
84 |
-
df2.columns = ['FCName', 'Count']
|
85 |
-
df = df.merge(df2, left_on = 'FCName', right_on = 'FCName',how='left')
|
86 |
|
87 |
return df
|
88 |
|
@@ -119,7 +123,7 @@ def mapF(data):
|
|
119 |
layers=[layer],
|
120 |
initial_view_state= view_state,
|
121 |
tooltip = {
|
122 |
-
"html": "<b>City,State:</b> {City} </br> <b>
|
123 |
"style": {
|
124 |
"backgroundColor": "steelblue",
|
125 |
"color": "white"
|
@@ -129,10 +133,10 @@ def mapF(data):
|
|
129 |
# st.pydeck_chart(r)
|
130 |
components.html(r.to_html(as_string=True), height=600)
|
131 |
|
132 |
-
data = load_data(state=queried_state,zip_code=queried_zip_code,city=queried_city,age=queried_age,male=queried_male,female=queried_female
|
133 |
|
134 |
if st.checkbox('Display data ?'):
|
135 |
data
|
136 |
|
137 |
-
|
138 |
|
|
|
1 |
from cmath import pi
|
2 |
from json import load, tool
|
3 |
from os import stat
|
4 |
+
#from telnetlib import RCP
|
5 |
import streamlit as st
|
6 |
import pandas as pd
|
7 |
import numpy as np
|
|
|
31 |
|
32 |
@st.cache(allow_output_mutation=True)
|
33 |
def gen_load() -> pd.DataFrame:
|
34 |
+
#df = my.get_data()
|
35 |
+
df = pd.read_csv('Locations.csv')
|
36 |
return df
|
37 |
|
38 |
+
#AI Emotional State Score: Anxiety, Confusion, Trepidation, Fear, Guilt
|
39 |
+
|
40 |
@st.cache(allow_output_mutation=True)
|
41 |
def gen_load_old() -> pd.DataFrame:
|
42 |
# file = pd.read_csv('us-zip-code-latitude-and-longitude.txt',names = ['Zip','City','State','lat','lon','Timezone',"Daylight Savings", "Geo point"], skiprows=1, delimiter=";")
|
43 |
filename = "US.txt"
|
44 |
file = pd.read_csv(filename,names = ['Country','Zip','City','State','Abb','Name1','Code1','Name2','Code2','lat','lon','Accuracy'], delimiter="\t",usecols=["Zip","City","State","Abb","lat","lon"])
|
|
|
45 |
file['Zip'] = file['Zip'].astype(str).str.zfill(5)
|
46 |
w = lambda x: (x[-5:])
|
47 |
filename = "NPIProviders.xlsx"
|
48 |
+
df = pd.read_csv('Locations.csv',header = None,names = ['Zip','TIN','Name', 'Services','Age','Gender','StartDate','Questions','Entity'], skiprows=1,converters={'Zip':w },usecols="A,B,C,D,E,F,G,H,I")
|
49 |
+
'Zip','TIN','Name', 'Services','Age','Gender','StartDate','Questions','Entity'
|
50 |
+
|
51 |
df = df.merge(file, left_on = 'Zip', right_on = 'Zip', how='inner')
|
52 |
df = df.fillna(" ")
|
53 |
return df
|
|
|
82 |
except:
|
83 |
pass
|
84 |
|
85 |
+
#value_counts = df["FCName"].value_counts()
|
86 |
+
#df2 = pd.DataFrame(value_counts)
|
87 |
+
#df2 = df2.reset_index()
|
88 |
+
#df2.columns = ['FCName', 'Count']
|
89 |
+
#df = df.merge(df2, left_on = 'FCName', right_on = 'FCName',how='left')
|
90 |
|
91 |
return df
|
92 |
|
|
|
123 |
layers=[layer],
|
124 |
initial_view_state= view_state,
|
125 |
tooltip = {
|
126 |
+
"html": "<b>City,State:</b> {City} </br> <b>Services:</b> {Count} </br> <b>F:</b> {FCName}",
|
127 |
"style": {
|
128 |
"backgroundColor": "steelblue",
|
129 |
"color": "white"
|
|
|
133 |
# st.pydeck_chart(r)
|
134 |
components.html(r.to_html(as_string=True), height=600)
|
135 |
|
136 |
+
data = load_data(state=queried_state,zip_code=queried_zip_code,city=queried_city,age=queried_age,male=queried_male,female=queried_female)
|
137 |
|
138 |
if st.checkbox('Display data ?'):
|
139 |
data
|
140 |
|
141 |
+
mapF(data)
|
142 |
|