def rename_extrema_df(center_extrema, df_features, return_samples=True):
    """Rename a dataframe based on the centered extrema.

    Parameters
    ----------
    center_extrema : {'trough', 'peak'}
        Which extrema is centered.
    df_features : pandas.DataFrames
        Bycycle dataframes to rename, given the centered extrema.
    return_samples : bool, optional, default: True
        Whether to rename sample columns if ``returns_samples`` is True when computing
        ``df_features`` using :func:`~.compute_features`.

    Returns
    -------
    df_features : pandas.DataFrames
        Updated dataframes.

    Examples
    --------
    Convert the column labels of a peak-centered dataframe to a trough-centered dataframe:

    >>> from neurodsp.sim import sim_bursty_oscillation
    >>> from bycycle.features import compute_features
    >>> fs = 500
    >>> sig = sim_bursty_oscillation(10, fs, freq=10)
    >>> sig = -sig  # invert the signal, flipping peaks and troughs
    >>> df_features = compute_features(sig, fs, f_range=(8, 12), center_extrema='peak')
    >>> df_features = rename_extrema_df('trough', df_features)
    """

    # Rename columns if they are actually trough-centered
    if center_extrema == 'trough':

        features_rename_dict = {'time_peak': 'time_trough',
                                'time_trough': 'time_peak',
                                'volt_peak': 'volt_trough',
                                'volt_trough': 'volt_peak',
                                'time_rise': 'time_decay',
                                'time_decay': 'time_rise',
                                'volt_rise': 'volt_decay',
                                'volt_decay': 'volt_rise'}

        df_features.rename(columns=features_rename_dict, inplace=True)

        # Need to reverse symmetry measures
        df_features['volt_peak'] = -df_features['volt_peak']
        df_features['volt_trough'] = -df_features['volt_trough']
        df_features['time_rdsym'] = 1 - df_features['time_rdsym']
        df_features['time_ptsym'] = 1 - df_features['time_ptsym']

        if return_samples:

            samples_rename_dict = {'sample_peak': 'sample_trough',
                                   'sample_zerox_decay': 'sample_zerox_rise',
                                   'sample_zerox_rise': 'sample_zerox_decay',
                                   'sample_last_zerox_decay': 'sample_last_zerox_rise',
                                   'sample_last_trough': 'sample_last_peak',
                                   'sample_next_trough': 'sample_next_peak'}

            df_features.rename(columns=samples_rename_dict, inplace=True)

    return df_features