Spaces:
Runtime error
Runtime error
File size: 1,031 Bytes
fd03181 b906a5a fd03181 f2a4ed0 f0acbd7 b906a5a 608cb34 dca7be1 c23fdff dca7be1 d7fcf66 dca7be1 f2a4ed0 89500a9 3b44d68 89500a9 1a22523 89500a9 |
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 |
import streamlit as st
import pandas as pd
# Load dataframe
file = st.file_uploader('Seleccione un archivo Excel: ')
if file is not None:
# Load the Excel file into a Pandas dataframe
df = pd.read_excel(file, engine='openpyxl')
# Show the dataframe in Streamlit
st.write(df.head())
st.write(df.columns)
# Sidebar option
option = st.sidebar.selectbox('Clasificar resultados por:', ('Pregunta', 'Categoria'))
# Group dataframe by chosen option
if option == 'Pregunta':
grouped_df = df.groupby('Pregunta')
elif option == 'Categoria':
grouped_df = df.groupby('Categoria')
# Generate text with bullets
text = ''
for name, group in grouped_df:
text += f'{name}:\n\n'
for index, row in group.iterrows():
text += f'- {row["Item"]}\n'
text += '\n'
# Download link for text file
st.markdown(f'<a href="data:text/plain;charset=utf-8,{text}" download="result.txt">Download Text File</a>', unsafe_allow_html=True)
|