Skip to content

Commit e7becbd

Browse files
committed
fix: Use Pandas Series instead of numpy array to ensure type compatibility
1 parent fdeb9b8 commit e7becbd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/bids/variables/variables.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def to_dense(self, sampling_rate=None):
413413
duration = math.ceil( # Round up to nearest second
414414
round(bin_sr * self.get_duration(), 3) # Cut off at millisecond precision
415415
)
416-
ts = np.zeros(duration, dtype=self.values.dtype)
416+
ts = pd.Series(0, index=np.arange(duration), dtype=self.values.dtype)
417417

418418
onsets = np.round(self.onset * bin_sr).astype(int)
419419
durations = np.round(self.duration * bin_sr).astype(int)
@@ -446,7 +446,6 @@ def to_dense(self, sampling_rate=None):
446446
source=self.source,
447447
sampling_rate=sampling_rate)
448448

449-
450449
return dense_var
451450

452451
def _extract_entities(self):

0 commit comments

Comments
 (0)