Filtering columns by header name

In my code I need to be able to filter column names(on the left component) and show only filtered columns with information after user uploaded a CSV file. This is my code but I am stuck on it at the moment and have no ideas of how I can implement the requirements.

    from enum import Enum
    from io import BytesIO, StringIO
    from typing import Union

    import pandas as pd
    import streamlit as st
except Exception as e:

STYLE = """
img {
    max-width: 100%;
    width: 900

class FileUpload(object):

    def __init__(self):
        self.fileTypes = ["csv", "png", "jpg"]

    def run(self):
        Upload File on Streamlit Code
        st.markdown(STYLE, unsafe_allow_html=True)
        st.sidebar.title("Filter data")
        st.set_option('deprecation.showfileUploaderEncoding', False)
        file = st.file_uploader("Upload file", type=self.fileTypes)
        show_file = st.empty()
        if not file:
  "Please upload a file of type: " +
                           ", ".join(["csv", "png", "jpg"]))
        content = file.getvalue()
        if isinstance(file, BytesIO):
            data = pd.read_csv(file)

if __name__ == "__main__":
    helper = FileUpload()

Hi @darkness49,

I think you can use multiselect with column names for this purpose, here’s a minimal code sample for the same.

import streamlit as st
import pandas as pd

# create some dataframe
df = pd.DataFrame({f"f_{i}": list(range(100)) for i in range(10)})

filtered = st.multiselect("Filter columns", options=list(df.columns), default=list(df.columns))