Pandas Reassign Row Values in Dataframe

My input dataframe is;

ID   Amount   result
45   1        default
46   2        default
47   3        default
48   5        default
48   10       default
49   12       default
50   5        default
50   7        default
50   9        default

Desired output is;

ID   Amount   result
45   1        default1
46   2        default1
47   3        default1
48   5        default1
48   10       default2
49   12       default1
50   5        default1
50   7        default2
50   9        default3

If ID is not changed default string should increase like this "default1", "default2". First is should always be "default1".

Could you please help me about this?



Read more here: https://stackoverflow.com/questions/64467048/pandas-reassign-row-values-in-dataframe

Content Attribution

This content was originally published by Salih at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: