Pandas - Replace values based on index
In addition to the other answers, here is what you can do if you have a list of individual indices:
indices = [0,1,3,6,10,15]df.loc[indices,'A'] = 16print(df.head(16))
Output:
A B0 16 41 16 42 4 33 16 44 1 15 3 06 16 47 2 18 4 49 3 410 16 011 3 112 4 213 2 214 2 115 16 1