Using pd.read_excel returns type dict and not dataframe

Basically the title, I have a xlsx file that Iโ€™m taking input using st.file_uploader() then reading it using df = pd.read_excel(). When I try to check the type(df) it returns dict instead of dataframe. Anyway to solve this?

Code:

uploaded_file = st.file_uploader("Select the MEV list file:", type="xlsx")
if uploaded_file is not None:
    df = pd.read_excel(uploaded_file, sheet_name=None)
    st.write(type(df))

Output:

type(df)classbuiltins.dict(...)

Expected:

<class 'pandas.core.frame.DataFrame'>

I recommend checking out the pandas documentation.

pd.read_excel returns a DataFrame or dict of DataFrames. When you use sheet_name=None you will get a dict.

1 Like

Thanks that worked for me. Itโ€™s weird though because when I check type(df) in jupyter notebook it outputs <class โ€˜pandas.core.frame.DataFrameโ€™>