events should be a NumPy array of integers, got numpy.ndarray

Yes, this is what I meant: your event cleaning function is broken and needs to be fixed. Right now it doesn’t return a valid events array.

I’d maybe start with explicitly specifying the dtype for each DataFrame column.

Richard