Skip to content

Commit

Permalink
Fix dtype for index due to csv
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgarcia committed Jan 15, 2025
1 parent a64aed9 commit bd1ebe8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/spikeinterface/core/sortinganalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,13 @@ def load_data(self):
import pandas as pd

ext_data = pd.read_csv(ext_data_file, index_col=0)
# really sad hack here because csv was a bad choice for saving a DataFrame (maybe a npy per columns would have been better)
unit_ids = self.sorting_analyzer.unit_ids
if ext_data.shape[0] == unit_ids.size:
# we force dtype to be the same as unit_ids
if ext_data.index.dtype != unit_ids.dtype:
ext_data.index = ext_data.index.astype(unit_ids.dtype)

elif ext_data_file.suffix == ".pkl":
with ext_data_file.open("rb") as f:
ext_data = pickle.load(f)
Expand Down

0 comments on commit bd1ebe8

Please sign in to comment.