def _load_insert_element_if_necessary(load_df, at):
    """
    Insert an event at the specified point that conserve data consistency
    for "area" and "load" values
    """
    if len(load_df[load_df.time == at]) == 0:
        prev_el = load_df[load_df.time <= at].tail(1)
        new_el = prev_el.copy()
        next_el = load_df[load_df.time >= at].head(1)
        new_el.time = at
        new_el.area = float(new_el.load) * float(next_el.time - at)
        load_df.loc[prev_el.index, 'area'] = float(prev_el.load) * float(at -
            prev_el.time)
        load_df.loc[len(load_df)] = [float(new_el.time), float(new_el.load),
            float(new_el.area)]
        load_df = load_df.sort_values(by=['time'])
    return load_df
