Display rain data into a nap
Drop files here
or click to upload
import streamlit as st
import pandas as pd
from sqlalchemy import create_engine
from sqlalchemy.orm import Session, DeclarativeBase
class Base(DeclarativeBase):
pass
# Database setup
database_url = "sqlite:///rain_data.sqlite"
engine = create_engine(database_url)
# Create tables
def fetch_rain_data():
# Fetch some sample rain data
# For the sake of this example, we will create a DataFrame.
data = {
'latitude': [37.76, 37.76, 37.77],
'longitude': [-122.4, -122.5, -122.4],
'rainfall': [10, 20, 15]
}
return pd.DataFrame(data)
# Fetch rain data
rain_data = fetch_rain_data()
# Display map with rainfall data
st.map(rain_data, latitude='latitude', longitude='longitude', size=rain_data['rainfall'], color="#00f")
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?