Skip to content

ENH: Implement interchange protocol for DatetimeTZDtype #54246

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

Merged
merged 5 commits into from
Jul 25, 2023

Conversation

mroeschke
Copy link
Member

@mroeschke mroeschke added the Interchange Dataframe Interchange Protocol label Jul 24, 2023
@mroeschke mroeschke added this to the 2.1 milestone Jul 25, 2023
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

Nice one, looks good to me

There should probably be a test for interchanging from non-pandas tz-aware, such as

pyarrow.Table
ts: timestamp[us, tz=Asia/Kathmandu]
----
ts: [[2019-12-31 18:15:00.000000,null,2020-01-01 18:15:00.000000]]

?

Anyway, not a blocker, I can do that separately

@@ -269,7 +274,11 @@ def _get_data_buffer(
DtypeKind.BOOL,
DtypeKind.DATETIME,
):
buffer = PandasBuffer(self._col.to_numpy(), allow_copy=self._allow_copy)
if self.dtype[0] == DtypeKind.DATETIME and len(self.dtype[2]) > 4:
Copy link
Member

Choose a reason for hiding this comment

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

so anything longer than 'tsn:' will go here (like tss:US/Pacific), nice

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah correct. Added a comment to that effect

@mroeschke mroeschke merged commit d2f05c2 into pandas-dev:main Jul 25, 2023
@mroeschke mroeschke deleted the enh/intch/dttz branch July 25, 2023 18:33
@mroeschke
Copy link
Member Author

There should probably be a test for interchanging from non-pandas tz-aware, such as

Yes definitely. Would be good to have that as a follow up

@MarcoGorelli
Copy link
Member

cool, I'll do that tomorrow

jamie-harness pushed a commit to jamie-harness/pandas1 that referenced this pull request Jul 26, 2023
…4246)

* ENH: Implement interchange protocol for DatetimeTZDtype

* Add type ignores

* Add comment
jamie-harness added a commit to jamie-harness/pandas1 that referenced this pull request Jul 26, 2023
…4246) (#36)

* ENH: Implement interchange protocol for DatetimeTZDtype

* Add type ignores

* Add comment

Co-authored-by: Matthew Roeschke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Interchange Dataframe Interchange Protocol
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Conversion of datetime64[ns, UTC] to Arrow C format string is not implemented
2 participants