elephant.pandas_bridge.event_to_dataframe

elephant.pandas_bridge.event_to_dataframe(event, parents=True, child_first=True)[source]

Convert a neo.core.Event to a pandas.DataFrame.

The pandas.DataFrame object has a single column, with each element being the event label from the event.label attribute.

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

Parameters:
eventneo Event

The Event 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.

Returns:
pandas DataFrame

A DataFrame containing the labels from event.

Notes

If the length of event.times and event.labels are not the same, the longer will be truncated to the length of the shorter.

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.