for name, surface in surfaces.groupby("topics"): export_gaze_positions_on_surface( directory, name.replace("surfaces.", ""), surface.data ) Extracting BOSS_WEST_SCREEN data... Traceback (most recent call last): File "", line 5, in surface.data File "/data/DATA_ANALYSIS/BOSS_PREPROCESSING/EYE/batchExportPupilLabs/Batch_Export.py", line 85, in export_gaze_positions_on_surface surface = surface.transform(extract_export_data, surface_name=name) File "/home/bullock/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/series.py", line 3915, in transform return super().transform(func, *args, **kwargs) File "/home/bullock/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/generic.py", line 10812, in transform result = self.agg(func, *args, **kwargs) File "/home/bullock/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/series.py", line 3905, in aggregate result = func(self, *args, **kwargs) File "/data/DATA_ANALYSIS/BOSS_PREPROCESSING/EYE/batchExportPupilLabs/Batch_Export.py", line 102, in extract_export_data gaze_datum["timestamp"], File "/home/bullock/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/series.py", line 1071, in __getitem__ result = self.index.get_value(self, key) File "/home/bullock/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/indexes/numeric.py", line 420, in get_value loc = self.get_loc(k) File "/home/bullock/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/indexes/numeric.py", line 479, in get_loc return super().get_loc(key, method=method, tolerance=tolerance) File "/home/bullock/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2897, in get_loc return self._engine.get_loc(key) File "pandas/_libs/index.pyx", line 107, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 126, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 141, in pandas._libs.index.IndexEngine._get_loc_duplicates TypeError: Cannot cast array data from dtype('float64') to dtype('