Skip to content

Instantly share code, notes, and snippets.

@jumpingchu
Last active April 24, 2021 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jumpingchu/d281ed0aec3741232167f59ff1f9c7b8 to your computer and use it in GitHub Desktop.
Save jumpingchu/d281ed0aec3741232167f59ff1f9c7b8 to your computer and use it in GitHub Desktop.
Using Pandas to read and convert Excel date style
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