Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,12 +18,12 @@ def get_column_name(possible_names, df):
|
|
| 18 |
for name in possible_names:
|
| 19 |
if name in df.columns:
|
| 20 |
return name
|
| 21 |
-
raise KeyError(f"None of the expected column names {possible_names} found in dataset")
|
| 22 |
|
| 23 |
# Map column names dynamically
|
| 24 |
-
designer_column = get_column_name(["
|
| 25 |
-
category_column = get_column_name(["
|
| 26 |
-
product_column = get_column_name(["
|
| 27 |
|
| 28 |
# Load full dataset
|
| 29 |
df = pd.read_csv(csv_file, nrows=10000)
|
|
|
|
| 18 |
for name in possible_names:
|
| 19 |
if name in df.columns:
|
| 20 |
return name
|
| 21 |
+
raise KeyError(f"None of the expected column names {possible_names} found in dataset. Available columns: {df.columns}")
|
| 22 |
|
| 23 |
# Map column names dynamically
|
| 24 |
+
designer_column = get_column_name(["brand_name"], df)
|
| 25 |
+
category_column = get_column_name(["product_category"], df)
|
| 26 |
+
product_column = get_column_name(["product_name"], df)
|
| 27 |
|
| 28 |
# Load full dataset
|
| 29 |
df = pd.read_csv(csv_file, nrows=10000)
|