Johnnyeee commited on
Commit
08ff0fa
1 Parent(s): bcef7dc

Update Yelpdata_663.py

Browse files
Files changed (1) hide show
  1. Yelpdata_663.py +6 -4
Yelpdata_663.py CHANGED
@@ -114,11 +114,13 @@ class YelpDataset(datasets.GeneratorBasedBuilder):
114
  ]
115
 
116
  def _generate_examples(self, filepath):
117
- """This function returns the examples in the raw (text) form."""
118
  logging.info("generating examples from = %s", filepath)
119
  with open(filepath, encoding="utf-8") as csv_file:
120
  reader = csv.DictReader(csv_file)
121
  for i, row in enumerate(reader):
122
- # Convert the row to a dictionary, removing any null values
123
- example = {key: value for key, value in row.items() if value is not None}
124
- yield i, example
 
 
 
114
  ]
115
 
116
  def _generate_examples(self, filepath):
117
+ """This function returns the examples in the raw (text) form."""
118
  logging.info("generating examples from = %s", filepath)
119
  with open(filepath, encoding="utf-8") as csv_file:
120
  reader = csv.DictReader(csv_file)
121
  for i, row in enumerate(reader):
122
+ # Convert specific fields to integers from floats
123
+ if 'is_open' in row and row['is_open']:
124
+ row['is_open'] = int(float(row['is_open']))
125
+ # Similarly convert other fields that need preprocessing
126
+ yield i, row