0

This question is similar to this question posted earlier. The difference is that I want to change value in a cell that index column is not unique. For example:

   x  y
A  1  5
B  4  6
C  0  3
C  5  9

I want to replace 9 with 100 and get:

   x  y
A  1  5
B  4  6
C  0  3
C  5  100

Any suggestions?

Community
  • 1
  • 1
NamAshena
  • 847
  • 2
  • 9
  • 15

1 Answers1

1

You could go for the ordinal indexes (they are always unique) like so:

In [13]: df.iloc[3, 1] = 100

In [14]: df
Out[14]: 
   x    y
A  1    5
B  4    6
C  0    3
C  5  100
Israel Unterman
  • 11,748
  • 2
  • 22
  • 31