Skip to content

ENH: Use tz-aware dtype for timestamp columns #263

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 7 commits into from

Conversation

tswast
Copy link
Collaborator

@tswast tswast commented Mar 23, 2019

I couldn't figure out how not to get a tz-aware dtype in 0.24.x
versions, and I wanted a tz-aware dtype anyway for TIMESTAMP, so this
makes it official.

Towards #261.

@tswast tswast force-pushed the issue261-tzaware-dtype branch from 3e442e8 to b0445ca Compare March 23, 2019 22:04
@tswast
Copy link
Collaborator Author

tswast commented Mar 25, 2019

Looks like we'll have to bump the minimum version to 0.20.0, as pandas.api.types.DatetimeTZDtype was first exposed publicly in pandas-dev/pandas#16099

tswast added 2 commits April 3, 2019 07:01
I couldn't figure out how *not* to get a tz-aware dtype in 0.24.x
versions, and I wanted a tz-aware dtype anyway for TIMESTAMP, so this
makes it official.
@tswast tswast force-pushed the issue261-tzaware-dtype branch from b0445ca to e1c2df4 Compare April 3, 2019 14:03
@tswast tswast marked this pull request as ready for review April 3, 2019 14:03
@tswast tswast requested a review from max-sixty April 3, 2019 14:03
Copy link
Contributor

@max-sixty max-sixty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that's ideal

DATETIME datetime64[ns]
TIME datetime64[ns]
DATE datetime64[ns]
================== =========================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tswast tswast force-pushed the issue261-tzaware-dtype branch from afe40c2 to 2a1c422 Compare April 3, 2019 16:21
@tswast tswast force-pushed the issue261-tzaware-dtype branch from 2a1c422 to c76dbba Compare April 3, 2019 16:39
This is the first version that passing a dtype of
pandas.api.types.DatetimeTZDtype(tz="UTC") to the Series constructor
actually works. I get "TypeError: data type not understood" in lower
versions.
@tswast
Copy link
Collaborator Author

tswast commented Apr 3, 2019

Oof. Looks like I still get the occasional TypeError: data type not understood for all versions before 0.24.0.

@max-sixty Thoughts on bumping the minimum version all the way to 0.24? It's a big jump from what we've had before. Otherwise, I'll see if I can make our tests robust against having naive datetime in 0.23 and before.

@tswast tswast force-pushed the issue261-tzaware-dtype branch from 4601721 to a5a11ab Compare April 3, 2019 18:10
@tswast tswast added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Apr 3, 2019
@tswast
Copy link
Collaborator Author

tswast commented Apr 3, 2019

I'm going to branch this PR with just the docs changes. I'd rather not bump all the way to 0.24.0 just yet.

@tswast
Copy link
Collaborator Author

tswast commented Apr 3, 2019

Closing in favor of #269. As was pointed out to me in pandas-dev/pandas#25843 (comment) it's more "idiomatic" to call localize rather than be specific about timezones in the dtype. I'd prefer to avoid additional casts / localization if at all possible, so just documenting the current behavior for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge Indicates a pull request not ready for merge, due to either quality or timing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants