HaryaniAnjali commited on
Commit
2e261c8
·
verified ·
1 Parent(s): cef0bbf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -50,7 +50,21 @@ def read_file(file):
50
  try:
51
  # Handle different file types
52
  if file_name.endswith('.csv'):
53
- return pd.read_csv(file)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  elif file_name.endswith(('.xls', '.xlsx')):
55
  return pd.read_excel(file)
56
  elif file_name.endswith('.json'):
 
50
  try:
51
  # Handle different file types
52
  if file_name.endswith('.csv'):
53
+ # For wine quality dataset which uses semicolons
54
+ if "winequality" in file_name.lower():
55
+ return pd.read_csv(file, sep=';')
56
+ else:
57
+ # Try standard comma separator first
58
+ try:
59
+ df = pd.read_csv(file)
60
+ # If we got only one column but it contains semicolons, try again with semicolon separator
61
+ if len(df.columns) == 1 and ';' in df.columns[0]:
62
+ return pd.read_csv(file, sep=';')
63
+ return df
64
+ except:
65
+ # Fall back to semicolon if comma fails
66
+ return pd.read_csv(file, sep=';')
67
+
68
  elif file_name.endswith(('.xls', '.xlsx')):
69
  return pd.read_excel(file)
70
  elif file_name.endswith('.json'):