-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
31 lines (22 loc) · 1.2 KB
/
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
29
30
31
import pandas as pd
import streamlit as st
import plotly.express as px
st.header('Anuncios de ventas de coches')
car_data = pd.read_csv('vehicles_us.csv') # leer los datos
hist_button = st.button('Construir histograma') # crear un botón
if hist_button: # al hacer clic en el botón
# escribir un mensaje
st.write('Creación de un histograma para el conjunto de datos de anuncios de venta de coches')
# crear un histograma
fig = px.histogram(car_data, x="odometer", color='condition')
# mostrar un gráfico Plotly interactivo
st.plotly_chart(fig, use_container_width=True)
# crear una casilla de verificación
build_scatter = st.checkbox('Seleccionar para generar el gráfico de dispersión')
if build_scatter: # si la casilla de verificación está seleccionada
#Escribir un mensaje
st.write('Gráfico de dispersión utilizando la columna odómetro y precio')
#Crear un gráfico de disperción
fig1 = px.scatter(car_data, x="odometer", y="price", color='model_year') # crear un gráfico de dispersión
# mostrar un gráfico Plotly interactivo
st.plotly_chart(fig1, use_container_width=True)