

     def getitem(self, idx):
         item = data.iloc[idx]
         table = pd.read_csv(table_csv_path + item.table_file).astype(
             str
         )  # be sure to make your table data text only
         encoding = self.tokenizer(
             table=table,
             queries=item.question,
             answer_coordinates=item.answer_coordinates,
             answer_text=item.answer_text,
             truncation=True,
             padding="max_length",
             return_tensors="pt",
         )
         # remove the batch dimension which the tokenizer adds by default
         encoding = {key: val.squeeze(0) for key, val in encoding.items()}
         # add the float_answer which is also required (weak supervision for aggregation case)
         encoding["float_answer"] = torch.tensor(item.float_answer)
         return encoding
     def len(self):
         return len(self.data)