I have a DataFrame:
df = pd.DataFrame({'B':[2,1,2],'C':['a','b','a']})
B C
0 2 'a'
1 1 'b'
2 2 'a'
I want to insert a row above any occurrence of 'b', that is a duplicate of that row but with 'b' changed to 'c', so I end up with this:
B C
0 2 'a'
1 1 'b'
1 1 'c'
2 2 'a'
For the life of me, I can't figure out how to do this.
ainstead ofcin third row.b?