def cmap_of(df, color, cmap=plt.cm.get_cmap('hot')):
    df = df.loc[:, [color]].fillna('???')
    byColor = df.groupby(color).count()
    byColor['unit'] = range(len(byColor))
    byColor.unit = (byColor.unit / len(byColor))
    byColor['color'] = byColor.unit.apply(cmap)
    return byColor.loc[df[color]].color
def cmap_of(df, color, cmap=plt.cm.get_cmap('hot')):
    df = df.loc[:, [color]].fillna('???')
    byColor = df.groupby(color).count()
    byColor['unit'] = range(len(byColor))
    byColor.unit = (byColor.unit / len(byColor))
    byColor['color'] = byColor.unit.apply(cmap)
    return byColor.loc[df[color]].color