-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
39 lines (29 loc) · 1.59 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
32
33
34
35
36
37
38
39
import pandas as pd
import plotly.express as px
import streamlit as st
car_data = pd.read_csv('vehicles_us.csv') # leer los datos
st.header('PROYECTO SPRINT 5')
hist_button = st.button('Construir histograma') # crear un botón
scatter_button= st.button("Construir un gráfico de dispersión") # crear otro botón
build_histogram = st.checkbox('Construir un histograma') #crea casilla
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")
# mostrar un gráfico Plotly interactivo
st.plotly_chart(fig, use_container_width=True)
if scatter_button: # al hacer clic en el otro botón
# escribir un mensaje
st.write('Creación de un gráfico de dispersión para el conjunto de datos de anuncios de venta de coches')
# crear un histograma
fig = px.scatter(car_data, x="odometer", y="price") # crear un gráfico de dispersión
# mostrar un gráfico Plotly interactivo
st.plotly_chart(fig, use_container_width=True)
if build_histogram: # 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")
# mostrar un gráfico Plotly interactivo
st.plotly_chart(fig, use_container_width=True)