Skip to content

Commit 7ae08cc

Browse files
authored
Merge pull request #3622 from samuelgarcia/fix_dataframe_index_dtype
Fix dataframe index dtype due to csv in quality metrics
2 parents 01d1479 + e3b2f16 commit 7ae08cc

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+
# we need to cast the index to the unit id dtype (int or str)
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)