Selectbox error in a specific value

[UPDATE: SOLVED by using unqiue() instead of drop_duplicates()

hi, I am just starting working on some tutorials. I am trying to create a selectbox filter for the Pclass variable in the titanic dataaset, the issue is I am getting an error when I select (2). I looked at the data but still not sure why it throws an error. Thanks for your help

import streamlit as st
st.set_page_config(page_title=None, page_icon=None,
                   layout='centered', initial_sidebar_state='auto')
import pandas as pd
import numpy as np

st.title('Your Titanic survival estimate')
DATA_URL = (''

def load_data():
    data = pd.read_csv('titanic.csv')
    return data

data_load_state = st.text('Loading data...')
data = load_data()
data_load_state.text("Done! (using st.cache)")

pclass = data['Pclass'].drop_duplicates()
pclass_drop = st.sidebar.selectbox("Pclass",pclass)

Hi @atheeralattar, welcome to the Streamlit community!! :wave: :partying_face:

I’m glad you found a solution!

Happy Streamlit-ing! :balloon:

1 Like