elephant.pandas_bridge.slice_spiketrain

elephant.pandas_bridge.slice_spiketrain(pdobj, t_start=None, t_stop=None)[source]

Slice a pandas.DataFrame, changing indices appropriately.

Values outside the sliced range are converted to NaN values.

Slicing happens over columns.

This sets the t_start and t_stop column indexes to be the new values. Otherwise it is the same as setting values outside the range to NaN.

Parameters:
pdobjpandas DataFrame

The DataFrame to slice.

t_startfloat, optional.

If specified, the returned DataFrame values less than this set to NaN. Default is None (do not use this argument).

t_stopfloat, optional.

If specified, the returned DataFrame values greater than this set to NaN. Default is None (do not use this argument).

Returns:
pdobjscalar, pandas Series, DataFrame, or Panel

The returned data type is the same as the type of pdobj

Notes

The order of the index and/or column levels of the returned object may differ from the order of the original.

If t_start or t_stop is specified, all columns indexes will be changed to the respective values, including those already within the new range. If t_start or t_stop is not specified, those column indexes will not be changed.

Returns a copy, even if t_start and t_stop are both None.