Skip to content
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

Add Python bindings for time zone data (TZiF) reader #12826

Merged

Conversation

shwina
Copy link
Contributor

@shwina shwina commented Feb 22, 2023

Description

This PR adds bindings to the TZiF reader that was added in the libcudf API in #12805.

No tests are being added as these bindings are just for internal-use. In follow-up PRs, I will add a timezone-aware datetime type and timezone-aware operations to the public API, along with tests for those operations.

The bindings can be used as follows:

>>> transition_times, offsets = make_timezone_transition_table("/usr/share/zoneinfo", "America/New_York")
                                            
>>> transition_times
<cudf.core.column.datetime.DatetimeColumn object at 0x7f95cd6ac840>
[
  1883-11-18 17:00:00,
  1883-11-18 17:00:00,
  1918-03-31 07:00:00,
  1918-10-27 06:00:00,
  1919-03-30 07:00:00,
  1919-10-26 06:00:00,
  1920-03-28 07:00:00,
  1920-10-31 06:00:00,
  1921-04-24 07:00:00,
  1921-09-25 06:00:00,
  ...
  2365-03-14 07:00:00,
  2365-11-07 06:00:00,
  2366-03-13 07:00:00,
  2366-11-06 06:00:00,
  2367-03-12 07:00:00,
  2367-11-05 06:00:00,
  2368-03-10 07:00:00,
  2368-11-03 06:00:00,
  2369-03-09 07:00:00,
  2369-11-02 06:00:00
]
dtype: datetime64[s]

>>> offsets
<cudf.core.column.timedelta.TimeDeltaColumn object at 0x7f94e69bad40>
[
  -18000,
  -18000,
  -14400,
  -18000,
  -14400,
  -18000,
  -14400,
  -18000,
  -14400,
  -18000,
  ...
  -14400,
  -18000,
  -14400,
  -18000,
  -14400,
  -18000,
  -14400,
  -18000,
  -14400,
  -18000
]
dtype: timedelta64[s]

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@github-actions github-actions bot added CMake CMake build issue conda Python Affects Python cuDF API. libcudf Affects libcudf (C++/CUDA) code. labels Feb 22, 2023
@github-actions github-actions bot removed the CMake CMake build issue label Mar 15, 2023
@shwina shwina changed the base branch from branch-23.04 to branch-23.06 April 5, 2023 16:39
@github-actions github-actions bot added the CMake CMake build issue label Apr 5, 2023
@shwina shwina added non-breaking Non-breaking change improvement Improvement / enhancement to an existing function labels Apr 7, 2023
@shwina shwina marked this pull request as ready for review April 7, 2023 20:21
@shwina shwina requested a review from a team as a code owner April 7, 2023 20:21
python/cudf/cudf/_lib/cpp/io/timezone.pxd Outdated Show resolved Hide resolved
python/cudf/cudf/_lib/timezone.pyx Outdated Show resolved Hide resolved
python/cudf/cudf/core/_internals/timezones.py Show resolved Hide resolved
@shwina shwina requested a review from bdice April 11, 2023 14:50
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

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

Needs a rebase because the commit history is broken but otherwise LGTM.

CHANGELOG.md Outdated Show resolved Hide resolved
python/cudf/cudf/_lib/cpp/libcpp/optional.pxd Show resolved Hide resolved
python/cudf/cudf/core/_internals/timezones.py Show resolved Hide resolved
@shwina shwina requested a review from bdice April 14, 2023 19:00
@shwina shwina force-pushed the timezone-table-python-bindings branch from de39018 to 8ec242b Compare April 17, 2023 12:19
@shwina shwina requested a review from a team as a code owner April 17, 2023 12:19
@shwina shwina requested a review from mythrocks April 17, 2023 12:19
@shwina shwina removed request for a team and mythrocks April 17, 2023 12:22
@shwina
Copy link
Contributor Author

shwina commented Apr 17, 2023

/merge

@rapids-bot rapids-bot bot merged commit b05d5e7 into rapidsai:branch-23.06 Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake CMake build issue improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants