Creating OrderedDict from csv file

@wilson_uzziel,

As @randyzwitch said, without more info, we may not help you the way you want.

However, just to give you an example of what you can do, here is a generic code snippet to display a DataFrame, and filter columns. I used this dataset for my tests. You’ll notice that I didn’t use any dict or OrderedDict at all.

import pandas as pd
import streamlit as st


def main():
    st.sidebar.title("GDP reader")

    df = load_csv("gdp.csv")

    for column in df.columns:
        options = pd.Series(["All"]).append(df[column], ignore_index=True).unique()
        choice = st.sidebar.selectbox("Select {}.".format(column), options)

        if choice != "All":
            df = df[df[column] == choice].drop(columns=column)
    
    st.table(df)


@st.cache
def load_csv(path):
    return pd.read_csv(path)


if __name__ == "__main__":
    main()
2 Likes