-
Notifications
You must be signed in to change notification settings - Fork 887
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
130 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
python/cudf/cudf/tests/groupby/test_ordering_pandas_compat.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
python/pylibcudf/pylibcudf/tests/test_string_convert_datetime.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright (c) 2024, NVIDIA CORPORATION. | ||
import datetime | ||
|
||
import pyarrow as pa | ||
import pyarrow.compute as pc | ||
import pylibcudf as plc | ||
import pytest | ||
from utils import assert_column_eq | ||
|
||
|
||
@pytest.fixture | ||
def fmt(): | ||
return "%Y-%m-%dT%H:%M:%S" | ||
|
||
|
||
def test_to_timestamp(fmt): | ||
arr = pa.array(["2020-01-01T01:01:01", None]) | ||
result = plc.strings.convert.convert_datetime.to_timestamps( | ||
plc.interop.from_arrow(arr), | ||
plc.DataType(plc.TypeId.TIMESTAMP_SECONDS), | ||
fmt, | ||
) | ||
expected = pc.strptime(arr, fmt, "s") | ||
assert_column_eq(result, expected) | ||
|
||
|
||
def test_from_timestamp(fmt): | ||
arr = pa.array([datetime.datetime(2020, 1, 1, 1, 1, 1), None]) | ||
result = plc.strings.convert.convert_datetime.from_timestamps( | ||
plc.interop.from_arrow(arr), | ||
fmt, | ||
plc.interop.from_arrow(pa.array([], type=pa.string())), | ||
) | ||
# pc.strftime will add the extra %f | ||
expected = pa.array(["2020-01-01T01:01:01", None]) | ||
assert_column_eq(result, expected) | ||
|
||
|
||
def test_is_timestamp(fmt): | ||
arr = pa.array(["2020-01-01T01:01:01", None, "2020-01-01"]) | ||
result = plc.strings.convert.convert_datetime.is_timestamp( | ||
plc.interop.from_arrow(arr), | ||
fmt, | ||
) | ||
expected = pa.array([True, None, False]) | ||
assert_column_eq(result, expected) |