Skip to content

Commit

Permalink
Fix weirdness in this implementation. np.empty is given a 1d array to…
Browse files Browse the repository at this point in the history
… instantiate but dtype contains multiple columns
  • Loading branch information
aamster committed Dec 8, 2021
1 parent d0a4ae7 commit 86ee3d6
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,13 +436,13 @@ def metrics(self):
raise NotImplementedError()

def empty_metrics_table(self):
# pandas can have issues interpreting type and makes the column 'object' type, this should enforce the
# correct data type for each column
empty_array = np.empty(self.unit_count, dtype=np.dtype(self.METRICS_COLUMNS))
empty_array[:] = np.nan

return pd.DataFrame(empty_array, index=self.unit_ids).rename_axis('unit_id')
empty_array = np.empty((self.unit_count, len(self.METRICS_COLUMNS)))

df = pd.DataFrame(empty_array,
index=pd.Index(self.unit_ids, name='unit_id'),
columns=[x[0] for x in self.METRICS_COLUMNS])
df = df.astype(dict(self.METRICS_COLUMNS))
return df

def _find_stimuli(self):
raise NotImplementedError()
Expand Down

0 comments on commit 86ee3d6

Please sign in to comment.