elephant.pandas_bridge.spiketrain_to_dataframe(spiketrain, parents=True, child_first=True)[source]

Convert a neo.SpikeTrain to a pandas.DataFrame.

The pandas.DataFrame object has a single column, with each element being the spike time converted to a float value in seconds.

The column heading is a pandas.MultiIndex with one index for each of the scalar attributes and annotations. The index is the spike number.

spiketrainneo SpikeTrain

The SpikeTrain to convert.

parentsbool, optional

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

pandas DataFrame

A DataFrame containing the spike times from spiketrain.


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.