def METHOD_NAME(
    df: pd.DataFrame,
    time_index: pd.PeriodIndex,
    agg_freq: Optional[str] = None,
) -> List[pd.Series]:
    df: pd.DataFrame = df.set_index(time_index)
    pivot_df = df.transpose()
    pivot_df.head()
    timeseries = []
    for row in pivot_df.iterrows():
        ts = pd.Series(row[1].values, index=time_index)
        if agg_freq is not None:
            ts = ts.resample(agg_freq).sum()
        first_valid = ts[ts.notnull()].index[0]
        last_valid = ts[ts.notnull()].index[-1]
        ts = ts[first_valid:last_valid]
        timeseries.append(ts)
    return timeseries