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

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

The objects can be any list, dict, or other iterable or mapping containing spiketrains, as well as any neo object that can hold spiketrains: neo.Block, neo.ChannelIndex, neo.Unit, 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 spiketrain, with each element being the spike time converted to a float value in seconds. 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 spiketrain. The index is the spike number.

containerlist, tuple, iterable, dict,

neo Block, neo Segment, neo Unit, neo ChannelIndex The container for the spiketrains 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 spike times from container.


The index name is spike_number.

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.