Change column value on identical indexes

Issue

This Content is from Stack Overflow. Question asked by Dante van der Heijden

Have the following dataframe:

enter image description here

Sometimes the index is duplicate and then I want to change the value in the column ‘Hotspot’. So prograding_feature_polygon_30 should be changed to prograding_feature_polygon_30_1 and the second on index 0 to prograding_feature_polygon_30_2.

The same on index 1, so again the values should be changed to prograding_feature_polygon_30_1 and prograding_feature_polygon_30_2. And so on…

Indexes are not always duplicate and if not, the value in Hotspot should remain the same. Anyone knows an easy way to do this?

Regards,

Dante



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?