Hi
Can someone help me?
Iām trying to create the following with Pyton & Streamlit:
In Streamlit I should be able to enter a place name and then it should show the zip code. The basis for this is a CSV file with all postcodes in Switzerland.
Can someone help me how to do this best?
Hello:
Below is my approach:
- Store the CSV using Pandas.
- Get input from the user (place)
- On clicking a button-the search function kicks in.
- On success, display the zipcode. Else an error message something like āZipcode not foundā.
Thanks !!!
Hello:
Please find the below python code:
import pandas as pd
import streamlit as st
df=pd.read_csv(rāreplace with your fileā)
st.dataframe(df)
x=st.text_input(āEnter the Pincodeā)
def fn():
for index, row in df.iterrows():
if(int(row[āPinCodeā])==int(x)):
y=row[āNameā]
break
else:
y=āErrorā
return(y)
if name==āmainā:
y1=fn()
st.write(y1)
Sample Output:
Can you modify your code as above. (indentation is missing in yours)
Hi @mr_swiss,
Please refrain from asking other community members to build your app. Weād love to help you build it! But asking others to write your entire app takes away all the fun