I have a sample data frame text column that contains strings including the word 'eng' and the word 'engine'.
ID Text
1 eng is here
2 engine needs washing
3 eng is overheating
I want to replace the word 'eng' with the word 'engine'. I use the code below:
df['Text'] = df['Text'].str.replace('eng', 'engine')
But this messes up my text in my second row. The second row becomes
ID Text
2 engineine needs washing
Is there a way to do the word replace so that it only replaces when the entire word says 'eng' only?