Spaces:
Sleeping
Sleeping
Update app.py
Browse files40 unmodified lines41424344454653 unmodified lines10010110210310410510611 unmodified lines11811912012112212312412512612712812940 unmodified linesif plot_type == "Barras":sns.barplot(x=x_col, y=y_col, data=data, ax=ax)elif plot_type == "Líneas":sns.lineplot(x=x_col, y=y_col, data=data, ax=ax)elif plot_type == "Dispersión":53 unmodified lineswith col1:plot_type = st.selectbox("Tipo de gráfico",["Barras", "Líneas", "Dispersión", "Histograma", "Boxplot", "Violín", "Pastel", "Mapa de calor"])# Opciones de columnas basadas en el tipo de gráfico11 unmodified lineselif plot_type == "Pastel":x_col = st.selectbox("Selecciona la columna para el gráfico de pastel", categorical_cols if categorical_cols else all_cols)y_col = Noneelse:x_options = categorical_cols + numeric_cols if categorical_cols else all_colsx_col = st.selectbox("Selecciona la columna para el eje X", x_options)with col3:if plot_type not in ["Histograma", "Pastel", "Mapa de calor"]:y_col = st.selectbox("Selecciona la columna para el eje Y", numeric_cols if numeric_cols else all_cols)# Crear gráfico40 unmodified lines41424344454647484950515253 unmodified lines10610710810911011111211 unmodified lines12412512612712812913013113213313413513613713840 unmodified linesif plot_type == "Barras":sns.barplot(x=x_col, y=y_col, data=data, ax=ax)elif plot_type == "Barras (Count)":# Crear conteo de valorescount_data = data[x_col].value_counts().reset_index()count_data.columns = [x_col, 'count']sns.barplot(x=x_col, y='count', data=count_data, ax=ax)plt.ylabel('Frecuencia')elif plot_type == "Líneas":sns.lineplot(x=x_col, y=y_col, data=data, ax=ax)elif plot_type == "Dispersión":53 unmodified lineswith col1:plot_type = st.selectbox("Tipo de gráfico",["Barras", "Barras (Count)", "Líneas", "Dispersión", "Histograma", "Boxplot", "Violín", "Pastel", "Mapa de calor"])# Opciones de columnas basadas en el tipo de gráfico11 unmodified lineselif plot_type == "Pastel":x_col = st.selectbox("Selecciona la columna para el gráfico de pastel", categorical_cols if categorical_cols else all_cols)y_col = Noneelif plot_type == "Barras (Count)":x_col = st.selectbox("Selecciona la columna para contar frecuencias", all_cols)y_col = "count" # Valor especial para indicar que se usará conteoelse:x_options = categorical_cols + numeric_cols if categorical_cols else all_colsx_col = st.selectbox("Selecciona la columna para el eje X", x_options)with col3:if plot_type not in ["Histograma", "Pastel", "Mapa de calor", "Barras (Count)"]:y_col = st.selectbox("Selecciona la columna para el eje Y", numeric_cols if numeric_cols else all_cols)# Crear gráfico
app.py+11-2