def filter_duplicates(data_set):
    """Removes duplicate properties (i.e. those measured at the same
    states) from a data set. For now, the measurement with the largest
    reported experimental uncertainty is retained.

    Notes
    -----
    Temperatures are compared in kelvin to two decimal places, while
    pressures are compared in kilopascals to three decimal places.

    Warnings
    --------
    This method is not guaranteed to be deterministic.

    Parameters
    ----------
    data_set: pandas.DataFrame
        The data set to remove duplicates from.

    Returns
    -------
    pandas.DataFrame
        The filtered data set.
    """

    if len(data_set) == 0:
        return data_set

    minimum_n_components = data_set["N Components"].min()
    maximum_n_components = data_set["N Components"].max()

    assert minimum_n_components == maximum_n_components

    data_set["Temperature (K)"] = data_set["Temperature (K)"].round(2)
    data_set["Pressure (kPa)"] = data_set["Pressure (kPa)"].round(3)

    subset_columns = ["Temperature (K)", "Pressure (kPa)", "Phase"]

    for index in range(minimum_n_components):

        data_set[f"Mole Fraction {index + 1}"] = data_set[
            f"Mole Fraction {index + 1}"
        ].round(6)

        subset_columns.extend(
            [
                f"Component {index + 1}",
                f"Role {index + 1}",
                f"Mole Fraction {index + 1}",
                f"Exact Amount {index + 1}",
            ]
        )

    subset_columns = [x for x in subset_columns if x in data_set]

    uncertainty_header = None

    for header in data_set:

        if "Uncertainty" not in header:
            continue

        assert uncertainty_header is None
        uncertainty_header = header

    if uncertainty_header in data_set:
        data_set = data_set.sort_values(uncertainty_header)

    return data_set.drop_duplicates(subset=subset_columns, keep="last")