I have data in pandas as below:
123-543-2345
876|678|3469
304-762-2467
Trying to change all to this format: 123-543-2345
I tried the different code below:
df["Phone_Number"].str.replace('[^a-zA-Z0-9]','')
#df['Phone_Number'].apply(lambda x: x[0.3] + '_' + x[3.6] + '_' + x[6.10])
df["Phone_Number"].apply(lambda x: str(x))
Yet still returning the same data without modification.
.str.replace()requiresregex=Trueto be specified when you supply a regex expression. $\endgroup$.str.replace()doesn't use regex by default. That changed in Pandas 2.0. $\endgroup$