0xrsydn commited on
Commit
45d5306
·
verified ·
1 Parent(s): 54ca818

Update ai_agent.py

Browse files
Files changed (1) hide show
  1. ai_agent.py +2 -2
ai_agent.py CHANGED
@@ -31,10 +31,10 @@ def sql_agent(file, agent_input):
31
 
32
  def pandas_agent(file, agent_input):
33
  # Check if the file extension is CSV
34
- if file.endswith('.csv'):
35
  df = pd.read_csv(file)
36
  # Check if the file extension is XLSX or XLS
37
- elif file.endswith('.xlsx') or file.endswith('.xls'):
38
  df = pd.read_excel(file)
39
  else:
40
  return "Unsupported file format. Only CSV, XLS, or XLSX files are supported."
 
31
 
32
  def pandas_agent(file, agent_input):
33
  # Check if the file extension is CSV
34
+ if file.name.endswith('.csv'):
35
  df = pd.read_csv(file)
36
  # Check if the file extension is XLSX or XLS
37
+ elif file.name.endswith('.xlsx') or file.name.endswith('.xls'):
38
  df = pd.read_excel(file)
39
  else:
40
  return "Unsupported file format. Only CSV, XLS, or XLSX files are supported."