simone-papicchio commited on
Commit
d44b620
·
1 Parent(s): 205d5cc

fix csv_reading

Browse files
Files changed (1) hide show
  1. utilities.py +4 -5
utilities.py CHANGED
@@ -62,11 +62,10 @@ def read_api(api_key_path):
62
  def read_models_csv(file_path):
63
  # Reads a CSV file and returns a list of dictionaries
64
  models = [] # Change {} to []
65
- with open(file_path, mode="r", newline="") as file:
66
- reader = csv.DictReader(file)
67
- for row in reader:
68
- row["price"] = float(row["price"]) # Convert price to float
69
- models.append(row) # Append to the list
70
  return models
71
 
72
  def csv_to_dict(file_path):
 
62
  def read_models_csv(file_path):
63
  # Reads a CSV file and returns a list of dictionaries
64
  models = [] # Change {} to []
65
+ df = pd.read_csv(file_path)
66
+ for _, row in df.iterrows():
67
+ model_dict = row.to_dict()
68
+ models.append(model_dict)
 
69
  return models
70
 
71
  def csv_to_dict(file_path):