I am trying to replace "/" to "-" in the column df['tran_date']
:
I have tried this but it does not work :
df['tran_date'].replace('/','-')
Could you please help? Thank you!
David
CodePudding user response:
replace
replaces the whole cell value, to replace a part of the string you need to use str.replace
:
df['tran_date'] = df['tran_date'].str.replace('/','-')
CodePudding user response:
Please try this .
df['tran_date'] = df['tran_date'].str.replace('/','-')