Creating a drop-down list for multiple selection of data frames

Hello everybody. I would like to create a drop-down list of multiple selection of data frames, that is, the user clicks and chooses the data frame he wants to analyze. thanks.

Hi @jonatapaulino,

Thank you for sharing with the Streamlit community!

I recommend checking out the following threads, which discuss very similar use-cases:

Happy to answer any follow-up questions you might have.



1 Like

Oi @Caroline , obrigado pela resposta. Eu vou estudar os tópicos sugeridos e volto pra dizer o que aconteceu.

@Caroline, I managed to use the two bases and show them, but from then on I have no idea how I can show filters of these same two bases besides showing them complete. For example, when selecting first base, I make some filters available to the user, and the same thing for second base!
There is my code and a picture of what I did.

Captura de Tela 2021-05-21 às 18.35.16|690x327

Importação das libs

from numpy import str_
#from pandas.core.indexes import base
import streamlit as st
import pandas as pd

## ======== Procedimentos com layout ======== ##
# Titulo do dachboard
title = st.title('Pagina de Teste')

## ======== Procedimentos com a base1 ======== ##
# Importação da base1
base1 = pd.read_excel('projetos_fadesp.xlsx')
# Excluir a linha 0
base1 = base1.drop(0)

## ======== Procedimentos com a base2 ======== ##
# Importação da base2
base2 = pd.read_excel('grupos_pesquisa_2021.xlsx')
# Excluindo coluna Unnamed: 3
base2 = base2.drop('Unnamed: 3', axis=1)

# Mostrando as bases
bases = {"Projetos da Fapesp": base1, "Grupos de Pesquisa da UFPA": base2}

# Includindo as bases em um slectbox
base_selecionada: str = st.sidebar.selectbox("Escolha uma Base", list(bases.keys()))
df = bases[base_selecionada]

# Uma mensagem a cima das bases
st.header('Base Selecionada')
#st.subheader('Base Selecionada')

# Mostra o dataframe