0

My data looks like this

Date Price
40179 7.65
10210 6.87

I want to change the Date to a YYYY-MM-DD format.

It should look like this:

Date Price
2010-01-01 7.65
2010-02-01 6.87

1 Answers1

0

Using @DarkKnight's comment, this would transform your dates:

import datetime

epoch = datetime.datetime.fromisoformat('1900-01-01')

# for every day value, here 40177
newday = epoch + datetime.timedelta(days=40177)
isostring = newday.strftime('%Y-%m-%d')
print(isostring) # 2010-01-01
Torge Rosendahl
  • 482
  • 6
  • 17