def freq_encoding(df, freq_cols):
    for c in freq_cols:
        count_df = df.groupby([c])['PetID'].count().reset_index()
        count_df.columns = [c, '{}_freq'.format(c)]
        df = df.merge(count_df, how='left', on=c)
    return df
def freq_encoding(df, freq_cols):
    for c in freq_cols:
        count_df = df.groupby([c])['PetID'].count().reset_index()
        count_df.columns = [c, '{}_freq'.format(c)]
        df = df.merge(count_df, how='left', on=c)
    return df