File size: 1,148 Bytes
1b974dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
921d551
1b974dd
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pandas as pd
import streamlit as st

def create_dataframe(file_path):
    # Read the CSV file into a Pandas dataframe
    df = pd.read_csv(file_path)
    
    # Create dynamic filters for each field
    filters = {}
    for col in df.columns:
        filters[col] = df[col].unique().tolist()
        
    return df, filters

if __name__ == '__main__':
    file_path = 'Carddata.csv'
    df, filters = create_dataframe(file_path)

    # Use Streamlit to display the dataframe and filters
    st.write('Dataframe:', df)
    st.write('Filters:', filters)
#In this code, we first read the CSV file into a Pandas dataframe using the pd.read_csv function. Then, we create a dictionary filters to store the unique values of each field in the dataframe. Finally, we use the streamlit library to display both the dataframe and the filters in a web-based interface.

#You can run this code in your terminal or command prompt by typing streamlit run filename.py, where filename.py is the name of the file containing this code. The output will be a web-based interface showing the dataframe and the filters, which you can interact with and explore.