I have the following data frame
prod_type
0 responsive
1 responsive
2 respon
3 r
4 respon
5 r
6 responsive
I would like to replace respon
and r
with responsive
, so the final data frame is
prod_type
0 responsive
1 responsive
2 responsive
3 responsive
4 responsive
5 responsive
6 responsive
I tried the following but it did not work:
df['prod_type'] = df['prod_type'].replace({'respon' : 'responsvie'}, regex=True)
df['prod_type'] = df['prod_type'].replace({'r' : 'responsive'}, regex=True)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…