dfnondup = df.drop_duplicates(['PplNum', 'RoomNum'])

def rename_dup(df):

    def rename_dup(df, c, dfnew):
        dfnondup = df.drop_duplicates(['PplNum', 'RoomNum'])
dfnondup['C'] = pd.Series([c] * len(dfnondup), index=dfnondup.index)
dfnew = pd.concat([dfnew, dfnondup], axis=0)
c += 1
dfdup = df[df.duplicated(['PplNum', 'RoomNum'])]
if dfdup.empty:
    return dfnew, c
else:
    return rename_dup(dfdup, c, dfnew)
return rename_dup(df, 1, pd.DataFrame())
dfnew, c = rename_dup(df)
Python Pandas Identify Duplicated rows with Additional Column