def merge_dfs_by_index(df1, df2):
    """
    Merge two pandas dataframe index-by-index.

    The dataframes have to share the same index name. Shared indexes will be
    merged without data loss. In case of conflicting entries a ValueError is 
    raised. The merge operation is symmetric and does not depend on the
    order of df1 and df2.

    Parameters
    ----------
    df1: dataframe
        Pandas dataframe to be extended
    df2: dataframe
        Pandas dataframe with used for extension
        
    Returns
    -------
    dataframe:
        The merged dataframe

    Raises
    ----------
    ValueError
        in case of incompatible index names or values
    """
    if df1.index.name != df2.index.name:
        raise ValueError('Dataframes have incompatible indexes: '
                         f'{df1.index.name} != {df2.index.name}.')

    # check for contradicting values by comparing A+B with B+A
    left_combine = df1.combine_first(df2)
    right_combine = df2.combine_first(df1)

    # ignoring dtypes when checking equality
    if not left_combine.astype(object).equals(right_combine.astype(object)):
        raise ValueError('Dataframes have incompatible values: '
                         f'{left_combine.compare(right_combine)}')

    return right_combine