Skip to content

ENH: better support for pandas time datatypes #12

Description

@drammock

Currently, pandas.Datetime will get converted to a string, and pandas.Timedelta causes segfaults (in some cases at least). This emerged when testing MNE-R compatibility with mne-tools/mne-python#7206, which overhauls the to_data_frame instance methods of MNE-Python. Sample R code to replicate the segfault:

library(reticulate)
use_condaenv('mnedev', conda='/opt/miniconda3/condabin/conda')  # edit path as needed
library(mne)

data_path <- mne$datasets$sample$data_path()
raw_fname <- paste(data_path, 'MEG', 'sample',
                   'sample_audvis_filt-0-40_raw.fif', sep = '/')
raw <- mne$io$read_raw_fif(raw_fname)$crop(tmax=10)

foo <- raw$to_data_frame()  # works
foo <- raw$to_data_frame(time_format=NULL)  # works
foo <- raw$to_data_frame(time_format='datetime')  # works, but time column is strings
foo <- raw$to_data_frame(time_format='timedelta')  # segfault: memory not mapped

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions