Skip to content

Instantly share code, notes, and snippets.

@kevin3
Created October 5, 2021 18:25
Show Gist options
  • Save kevin3/9fa8622ae7abf40d806e957270ba3788 to your computer and use it in GitHub Desktop.
Save kevin3/9fa8622ae7abf40d806e957270ba3788 to your computer and use it in GitHub Desktop.
def read_date(date):
if isinstance(date, int):
return pd.to_datetime(date,unit='D', origin='1899-12-30')
#return xlrd.xldate.xldate_as_datetime(date, 0)
else:
return(pd.to_datetime(date))
print("Converting 42985 to")
print(read_date(42985 ))
print("Converting ")
print(filtered_class['Posting_Date'][3637192])
print(read_date(filtered_class['Posting_Date'][3637192]))
print(pd.to_datetime(42985,unit='D', origin='1899-12-30'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment