I have this pandas dataframe:
Score # Bads # Goods
(470, 480] 3 2
(480, 490] 5 6
(490, 500] 20 24
(500, 510] 63 99
(510, 520] 176 230
(520, 530] 555 825
(530, 540] 1272 2105
(540, 550] 3298 7084
(550, 560] 7559 18819
(560, 570] 11293 31546
(570, 580] 7475 24476
(580, 590] 7982 31377
(590, 600] 4699 22787
(600, 610] 3125 18899
(610, 620] 1741 11193
(620, 630] 771 6553
(630, 640] 346 3603
(640, 650] 144 1756
(650, 660] 56 778
(660, 670] 23 277
(670, 680] 5 84
(680, 690] 0 18
(690, 700] 0 2
I need to replace the commas (",") in the Score column with the symbol " -< ". I have coded this:
df['Score'] = df['Score'].replace(',', "-<")
print(df)
but the commas are not replaced at all: they remain in the dataframe.
Score # Bads # Goods
(470, 480] 3 2
(480, 490] 5 6
(490, 500] 20 24
(500, 510] 63 99
(510, 520] 176 230
(520, 530] 555 825
(530, 540] 1272 2105
(540, 550] 3298 7084
(550, 560] 7559 18819
(560, 570] 11293 31546
(570, 580] 7475 24476
(580, 590] 7982 31377
(590, 600] 4699 22787
(600, 610] 3125 18899
(610, 620] 1741 11193
(620, 630] 771 6553
(630, 640] 346 3603
(640, 650] 144 1756
(650, 660] 56 778
(660, 670] 23 277
(670, 680] 5 84
(680, 690] 0 18
(690, 700] 0 2
I don't understand why the code above doesn't work.