awacke1's picture
Update app.py
921d551
raw
history blame contribute delete
No virus
1.15 kB
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.