def redistribute_units(df, left_columns, right_column, weight_against='na'):
    """
    When combining datasets, some columns might be duplicated. This is a common
    scenario when including planned costs in a DCM report that has more dimensions
    than just placement. DCM doesn't take into account repeated placements and
    the planned values are duplicated and thus inaccurate. This function divides
    a column evenly:
    Example:
    >>> df = DataFrame({'Col1': ['A', 'A', 'A', 'B', 'B'],
                    'Col2': [1000, 1000, 1000, 1000, 1000]})
    >>> df
      Col1  Col2
    0    A  1000
    1    A  1000
    2    A  1000
    3    B  2000
    4    B  2000

    >>> redistribute_units(df, ['Col1'], 'Col2')
    >>>
    0     333.333333
    1     333.333333
    2     333.333333
    3    1000.000000
    4    1000.000000
    dtype: float64
    """

    if weight_against == "na":

        mapping = df.groupby(left_columns).count()
        counts = df.apply(lambda row: mapping.loc[tuple(row[left_columns])][right_column], axis=1)
        return df[right_column] / counts

    else:

        sums = df.groupby(left_columns)[weight_against].sum()
        weights = df.apply(lambda row: row[weight_against] / sums.loc[tuple(row[left_columns])], axis=1)

        return df[right_column] * weights