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 |
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 |
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