def _remove_t0_from_wide_db(times_needed, _db):
    """
    This function finds the first set of values for each model and scenario and
    subtracts them from all values to remove the offset.
    """
    for model, scenario in set(zip(_db.index.get_level_values('model'), _db
        .index.get_level_values('scenario'))):
        offset = _db.loc[model, scenario, min(times_needed)].copy(
            ).values.squeeze()
        for time in times_needed:
            _db.loc[model, scenario, time] = _db.loc[model, scenario, time
                ] - offset
