data_baseanalyzetemporal_binningtemporal_binning_pd

temporal_binning_pd

data_base.analyze.temporal_binning.temporal_binning_pd(df, bin_size=None, min_time=None, max_time=None, normalize=True, bin_borders=None, rate=False)

Bin timevalues in a pandas DataFrame.

Given a dataframe containing time values in columns whose name can be converted to an integer, this function bins the values. It assumes that all columns whose names are integer-convertible contain time values. This is true for Presynaptic spike times and Synapse activation dataframes.

Parameters:
  • df (pandas.DataFrame) – DataFrame with containing time values in columns whose name are integer-convertible.

  • bin_size (float, optional) – Size of the bins. If not specified, bin_borders have to be specified.

  • min_time (float, optional) – Minimum time to consider. If not specified, the minimum value in the DataFrame is used.

  • max_time (float, optional) – Maximum time to consider. If not specified, the maximum value in the DataFrame is used.

  • bin_borders (list, optional) – List of bin borders. If not specified, bin_size has to be specified.

  • normalize (bool, optional) – If True, normalize the output to the total number of elements in the DataFrame.

  • rate (bool, optional) – If True, normalize the output to the bin size.

Returns:

Tuple containing the bin borders and the binned data.

Return type:

tuple