def get_samples_per_group(pwd, groupings=None, haploid=True):
    """
    Returns the number of samples in each group.
    """
    if groupings is None:
        return {n:(1+haploid) for n in pwd.index}
    else:
        return (pwd.groupby(groupings).apply(len)*(1+haploid)).to_dict()