import collections


def normalize_network_by_type(n_df, typ, wgt):
    """
    Normalize the network.

    Currently the only normalization method implemented is by type.

    Parameters:
        n_df (list): the data
        typ (int): the type column
        wgt (int): the weight column

    Returns:
        list: the modified data
    """
    sums = collections.Counter()
    for i in n_df:
        sums[i[typ]] += i[wgt]

    return [i[:wgt] + ("{:.6g}".format(i[wgt]/sums[i[typ]]),) + i[wgt+1:] for i in n_df]