def avg_ttm_2y(df):
    """
    Calculate 2-year averages from TTM financial data, which has 4 data-points
    per year, and each data-point covers the Trailing Twelve Months.

    This is different from using a rolling average on TTM data, which
    over-weighs the most recent quarters in the average.

    This function should only be used on DataFrames for a single stock.
    Use :obj:`~simfin.utils.apply` with this function on DataFrames for
    multiple stocks.

    :param df:
        Pandas DataFrame with TTM financial data sorted ascendingly by date.

    :return:
        Pandas DataFrame with 2-year averages.
    """
    return 0.5 * (df + df.shift(4))
