Last active
April 24, 2021 07:00
-
-
Save jumpingchu/d281ed0aec3741232167f59ff1f9c7b8 to your computer and use it in GitHub Desktop.
Using Pandas to read and convert Excel date style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import pandas as pd | |
import openpyxl # 讀取 Excel 檔案的 engine | |
df = pd.read_excel('YOUR_FILE.xlsx', engine='openpyxl') | |
df['real_date'] = pd.TimedeltaIndex(df['date'], unit='d') + datetime(1899, 12, 30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment