Skip to content

Modified xldate_as_tuple() to return microseconds. #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Modified xldate_as_tuple() to return microseconds. #77

wants to merge 1 commit into from

Conversation

jmcnamara
Copy link
Contributor

Return microseconds from xldate_as_tuple() for additional
compatibility with datetime and pandas. Issue #76

Return microseconds from xldate_as_tuple() for additional
compatibility with datetime and pandas. Issue #76
@jmcnamara
Copy link
Contributor Author

Hi Chris,

I suspect there's a lot of code out there that assumes that tuple will be of the current length.

That is a fair point.

a separate function (maybe xldate_as_extended_tuple()?), although I suspect you'd end up with a big chunk of duplicate code for speed reasons

That is a reasonable possibility. To avoid duplication, xldate_as_tuple() could be a wrapper around xldate_as_extended_tuple(). However, as you say this would introduce a performance overhead.

If you fancy a bigger challenge, it would be great to have an option to open_workbook, say, open_workbook(..., datetime=True) that would result in the value of the cell being as real datetime object rather than a float

Which lead us to this logical conclusion. :-)

I'd be willing to try implement a xldate_as_datetime() function (with testcases and 1904 epoch support) that returned a datetime.datetime object from an excel serial date/time. If the performance of that is reasonable you can decide if it is worth wiring up to the cell object.

I'll put it on a separate branch/PR and you can close this one if you want.

Regards,

John

@cjw296
Copy link
Member

cjw296 commented Jan 18, 2014

Ah, penny dropped.

Yes, xldate_as_datetime(xldate, datemode) would be great, and yes, probably done in a separate branch.
I'll close this one off for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants