I have a dataset that looks like this:
ID | Site Link | Active |
---|---|---|
1 | example | 1 |
2 | example-example | 1 |
3 | another-example | 0 |
4 | lastexample | 0 |
I want it to look like this:
ID | Site Link | Active |
---|---|---|
1 | example | 1 |
2 | example example | 1 |
3 | another example | 0 |
4 | lastexample | 0 |
So, I tried this:
df['Site link']=df['Site link'].str.repalce('-',' ')
However, it returned this error:
'StringMethods' object has no attribute 'repalce'
How can I solve the issue?
CodePudding user response:
Just a typo:
df['Site link']=df['Site link'].str.replace('-',' ')
CodePudding user response:
You mistyped replace, and also the str
is not needed. This should work:
df['Site link']=df['Site link'].replace('-',' ')