-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
30 lines (19 loc) · 911 Bytes
/
app.py
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
import streamlit as st
import pandas as pd
import plotly.express as px
df = pd.read_csv("vehicles_us.csv")
st.title("Car Advertisement Dashboard")
st.header("Exploratory Data Analysis")
st.subheader("Price Distribution")
fig_price = px.histogram(df, x='price', nbins=50, title="Price Distribution")
st.plotly_chart(fig_price)
st.subheader("Scatter Plot: Odometer vs. Price")
fig_scatter = px.scatter(df, x='odometer', y='price', color='condition', title="Odometer vs. Price")
st.plotly_chart(fig_scatter)
st.subheader("Filter High-Value Cars")
high_value = st.checkbox("Show cars priced above $50,000")
if high_value:
filtered_df = df[df['price'] > 50000]
st.write(f"Showing {len(filtered_df)} cars priced above $50,000")
fig_filtered = px.scatter(filtered_df, x='odometer', y='price', color='condition', title="High-Value Cars: Odometer vs. Price")
st.plotly_chart(fig_filtered)