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 cython for converting strings/fixed-point functions #7429

Merged
merged 16 commits into from
Mar 4, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test_string_decimal pytest
davidwendt committed Feb 25, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 2269b9f92225bd86ecadfef2755bca8ec63f9c73
15 changes: 15 additions & 0 deletions python/cudf/cudf/tests/test_string.py
Original file line number Diff line number Diff line change
@@ -206,6 +206,21 @@ def test_string_astype(dtype):
assert_eq(expect, got)


def test_string_decimal():
davidwendt marked this conversation as resolved.
Show resolved Hide resolved
gs = Series(["1.11", "2.22", "3.33"])
fp = gs.astype(cudf.Decimal64Dtype(scale=2, precision=3))
got = fp.astype("str")
assert_eq(gs, got)
gs = Series(["111", "222", "33"])
fp = gs.astype(cudf.Decimal64Dtype(scale=0, precision=3))
got = fp.astype("str")
assert_eq(gs, got)
gs = Series(["111000", "22000", "3000"])
fp = gs.astype(cudf.Decimal64Dtype(scale=-3, precision=3))
got = fp.astype("str")
assert_eq(gs, got)


Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codereport For input on pytest test cases.

@pytest.mark.parametrize(
"dtype", NUMERIC_TYPES + DATETIME_TYPES + ["bool", "object", "str"]
)