Spaces:
Runtime error
Runtime error
File size: 834 Bytes
0b2b2dc d30adf0 fa51aa8 baa2a05 db9bec1 6e598b9 6f24fe3 6e598b9 db9bec1 8105114 2784e1a 8105114 0b2b2dc 6f18e1d 4509ea8 fa51aa8 6f24fe3 fa51aa8 db9bec1 6bc184e aadf0ce 6f24fe3 3b498d7 6f18e1d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import streamlit as st
import pandas as pd
astations = [
["hongkongobservatory","HKO",22.3022566,114.1722662,"Hong Kong Observatory"],
["kingspark","KP",22.3115408,114.1685675,"Observatory Meteorological Station, King's Park"],
]
astationcolumns = ['akey','astationcode','alatitude','alongitude','atitle',]
acontainer1 = st.empty()
acontainer2 = st.empty()
acontainer3 = st.empty()
def asubmit(aparam):
adf2 = aparam["adataframe"]
aselecteditem = adf2[adf2.loc[adf2["atitle"]==aparam["aselected"]]]["astationcode"]
aparam["acontainer"].write((" {} ").format(aselecteditem))
adf = pd.DataFrame(
astations,
columns=astationcolumns
)
aoption = acontainer1.selectbox(
'Which station?',
adf['atitle']
)
if acontainer2.button("Submit") == True:
asubmit(aparam={"aselected":aoption,"acontainer":acontainer3,"adataframe":adf,}) |