penguins / src /streamlit_app.py
louiecerv's picture
Update src/streamlit_app.py
e0848c0 verified
raw
history blame contribute delete
744 Bytes
import altair as alt
import pandas as pd
import seaborn as sns
import streamlit as st
st.title("Palmer's Penguins")
st.markdown("Use this Streamlit app to make your own scatterplot about penguins!")
selected_x_var = st.selectbox("What do you want the x variable to be?",
["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"],
)
selected_y_var = st.selectbox("What about the y?",
["bill_length_mm", "bill_depth_mm", "flipper_length_mm", "body_mass_g"],
)
penguins_df = pd.read_csv("src/penguins.csv")
alt_chart = (alt.Chart(penguins_df, title="Scatterplot of Palmer's Penguins").mark_circle()
.encode(
x=selected_x_var,
y=selected_y_var,
color="species",
)
.interactive()
)
st.altair_chart(alt_chart, use_container_width=True)