0

I have the following data frame:

DATE

16.12.2022

15.12.2022

14.12.2022

13.12.2022

12.12.2022

I want to replace the "." in my DATE column with "-"

The current code I was using is as follows:

df2['DATE'] = df2['DATE'].replace('.','-')

But this would provide the following output:

0       ----------
1       ----------
2       ----------
3       ----------
4       ----------

All of the text in date has been replaced with "-"

Any suggestions as how I can make this work?

3
  • Try this stackoverflow.com/questions/38067704/… Commented Dec 29, 2022 at 23:21
  • 1
    do a print(df2.dtypes) and show us the reults Commented Dec 29, 2022 at 23:23
  • result['DATE']= pd.to_datetime(result['DATE'], dayfirst=True) Commented Dec 29, 2022 at 23:28

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.