def clean_consecutive_duplicates(
    move_data, subset=None, keep="first", inplace=False
):
    """
    Removes consecutives duplicate rows of the Dataframe, optionally only
    certaind columns can be consider.

    Parameters
    ----------
    move_data : dataframe
        The input trajectory data
    subset : Array of Strings, optional(None by default)
        Specifies  Column label or sequence of labels, considered for identifying duplicates.
        By default all columns are used.
    keep : String. Optional(first by default)
        Determine wich duplicate will be removed.
        if keep is set as first, all the duplicates except for the first occurrence will be droped. Otherwise,
        all duplicates except for the last occurrence will be droped.
    inplace : boolean, optional(False by default)
        if set to true the original dataframe will be altered, the duplicates will be droped in place,
        otherwise a copy will be returned.

    Returns
    -------
    move_data : dataframe or None
        The filtered trajectories points without consecutive duplicates.
    """

    if keep == "first":
        n = 1
    else:
        n = -1

    if subset is None:
        filter_ = (move_data.shift(n) != move_data).any(axis=1)
    else:
        filter_ = (move_data[subset].shift(n) != move_data[subset]).any(axis=1)

    return move_data.drop(index=move_data[~filter_].index, inplace=inplace)