Skip to content

Commit bd1ebe8

Browse files
committed
Fix dtype for index due to csv
1 parent a64aed9 commit bd1ebe8

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/spikeinterface/core/sortinganalyzer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,6 +2092,13 @@ def load_data(self):
20922092
import pandas as pd
20932093

20942094
ext_data = pd.read_csv(ext_data_file, index_col=0)
2095+
# really sad hack here because csv was a bad choice for saving a DataFrame (maybe a npy per columns would have been better)
2096+
unit_ids = self.sorting_analyzer.unit_ids
2097+
if ext_data.shape[0] == unit_ids.size:
2098+
# we force dtype to be the same as unit_ids
2099+
if ext_data.index.dtype != unit_ids.dtype:
2100+
ext_data.index = ext_data.index.astype(unit_ids.dtype)
2101+
20952102
elif ext_data_file.suffix == ".pkl":
20962103
with ext_data_file.open("rb") as f:
20972104
ext_data = pickle.load(f)

0 commit comments

Comments
 (0)