def add_distances(ec_table, dist_map, target_column="dist"):
    """
    Add pair distances to EC score table

    Parameters
    ----------
    ec_table : pandas.DataFrame
        List of evolutionary couplings, with pair
        positions in columns i and j
    dist_map : DistanceMap
        Distance map that will be used to annotate
        distances in ec_table
    target_column : str
        Name of column in which distances will be stored

    Returns
    -------
    pandas.DataFrame
        Couplings table with added distances
        in target_column. Pairs where no distance
        information is available will be np.nan
    """
    ec_table = ec_table.copy()

    ec_table.loc[:, target_column] = [
        dist_map.dist(i, j, raise_na=False)
        for i, j in zip(ec_table.i, ec_table.j)
    ]

    return ec_table