Mtcars dashboard
To upload files, please first save the app
import streamlit as st
import pandas as pd
# Load the mtcars dataset
@st.cache_data
def load_data():
return pd.read_csv("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/mpg.csv")
mtcars_data = load_data()
st.title("Mtcars Dashboard")
# Sidebar for filters
st.sidebar.header("Filters")
cylinders = st.sidebar.multiselect(
"Select Number of Cylinders:",
options=mtcars_data['cyl'].unique(),
default=mtcars_data['cyl'].unique()
)
# Filter data based on selections
filtered_data = mtcars_data.query("cyl in @cylinders")
# Show filtered data
st.subheader("Filtered Data")
st.write(filtered_data)
# Display a table
st.table(filtered_data.describe())
# Histogram of mpg
st.subheader("Histogram of Miles Per Gallon (mpg)")
st.bar_chart(filtered_data['mpg'].value_counts())
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?