Johnnyeee commited on
Commit
55097f0
1 Parent(s): fe25927

Update Yelpdata_663.py

Browse files
Files changed (1) hide show
  1. Yelpdata_663.py +7 -3
Yelpdata_663.py CHANGED
@@ -120,6 +120,10 @@ class YelpDataset(datasets.GeneratorBasedBuilder):
120
  with open(filepath, encoding="utf-8") as csv_file:
121
  reader = csv.DictReader(csv_file)
122
  for i, row in enumerate(reader):
123
- # Convert the row to a dictionary, removing any null values
124
- example = {key: value for key, value in row.items() if value is not None}
125
- yield i, example
 
 
 
 
 
120
  with open(filepath, encoding="utf-8") as csv_file:
121
  reader = csv.DictReader(csv_file)
122
  for i, row in enumerate(reader):
123
+ # Handle missing values for float fields
124
+ for key, value in row.items():
125
+ if value == '':
126
+ # Assuming all fields that can be empty are floats; adjust as needed
127
+ row[key] = 0.0 # Or `None`, depending on how you want to handle missing values
128
+ yield i, row
129
+