elephant.pandas_bridge.multi_events_to_dataframe(container, parents=True, child_first=True)[source]

Convert one or more neo.Event objects to a pandas.DataFrame.

The objects can be any list, dict, or other iterable or mapping containing events, as well as any neo object that can hold events: neo.Block and neo.Segment. Objects are searched recursively, so the objects can be nested (such as a list of blocks).

The pandas.DataFrame object has one column for each event, with each element being the event label. columns are padded to the same length with NaN values.

The column heading is a pandas.MultiIndex with one index for each of the scalar attributes and annotations of the respective event. The index is the time stamp from the event.times attribute.

containerlist, tuple, iterable, dict, neo Block, neo Segment

The container for the events to convert.

parentsbool, optional

Also include attributes and annotations from parent neo objects (if any).

child_firstbool, optional

If True (default True), values of child attributes are used over parent attributes in the event of a name conflict. If False, parent attributes are used. This parameter does nothing if parents is False.

pandas DataFrame

A DataFrame containing the labels from container.


If the length of event.times and event.labels are not the same for any individual event, the longer will be truncated to the length of the shorter for that event. Between events, lengths can differ.

The index name is times.

Attributes that contain non-scalar values are skipped. So are annotations or attributes containing a value of None.

quantity.Quantities types are incompatible with pandas, so attributes and annotations of that type are converted to a tuple where the first element is the scalar value and the second is the string representation of the units.