Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
|
3 |
+
def create_dataframe(file_path):
|
4 |
+
# Read the CSV file into a Pandas dataframe
|
5 |
+
df = pd.read_csv(file_path)
|
6 |
+
|
7 |
+
# Create dynamic filters for each field
|
8 |
+
filters = {}
|
9 |
+
for col in df.columns:
|
10 |
+
filters[col] = df[col].unique().tolist()
|
11 |
+
|
12 |
+
return df, filters
|
13 |
+
|
14 |
+
if __name__ == '__main__':
|
15 |
+
file_path = 'path/to/csv/file.csv'
|
16 |
+
df, filters = create_dataframe(file_path)
|
17 |
+
print('Dataframe:')
|
18 |
+
print(df)
|
19 |
+
print('\nFilters:')
|
20 |
+
print(filters)
|