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

Fix dtype errors in StringArrays #16111

Merged
merged 6 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 16 additions & 0 deletions python/cudf/cudf/pandas/_wrappers/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,22 @@ def Index__new__(cls, *args, **kwargs):
},
)

ArrowStringArrayNumpySemantics = make_final_proxy_type(
"ArrowStringArrayNumpySemantics",
_Unusable,
pd.core.arrays.string_arrow.ArrowStringArrayNumpySemantics,
fast_to_slow=_Unusable(),
slow_to_fast=_Unusable(),
)

ArrowStringArray = make_final_proxy_type(
"ArrowStringArray",
_Unusable,
pd.core.arrays.string_arrow.ArrowStringArray,
fast_to_slow=_Unusable(),
slow_to_fast=_Unusable(),
)

StringDtype = make_final_proxy_type(
"StringDtype",
_Unusable,
Expand Down
3 changes: 2 additions & 1 deletion python/cudf/cudf/pandas/scripts/run-pandas-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ and not test_s3_roundtrip"
TEST_THAT_CRASH_PYTEST_WORKERS="not test_bitmasks_pyarrow \
and not test_large_string_pyarrow \
and not test_interchange_from_corrected_buffer_dtypes \
and not test_eof_states"
and not test_eof_states \
and not test_array_tz"

# TODO: Remove "not db" once a postgres & mysql container is set up on the CI
PANDAS_CI="1" timeout 30m python -m pytest -p cudf.pandas \
Expand Down
23 changes: 23 additions & 0 deletions python/cudf/cudf_pandas_tests/test_cudf_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1533,3 +1533,26 @@ def test_is_proxy_object():
assert is_proxy_object(np_arr_proxy)
assert is_proxy_object(s1)
assert not is_proxy_object(s2)


def test_arrow_string_arrays():
cu_s = xpd.Series(["a", "b", "c"])
pd_s = pd.Series(["a", "b", "c"])

cu_arr = xpd.arrays.ArrowStringArray._from_sequence(
cu_s, dtype=xpd.StringDtype("pyarrow")
)
pd_arr = pd.arrays.ArrowStringArray._from_sequence(
pd_s, dtype=pd.StringDtype("pyarrow")
)

tm.assert_equal(cu_arr, pd_arr)

cu_arr = xpd.core.arrays.string_arrow.ArrowStringArray._from_sequence(
cu_s, dtype=xpd.StringDtype("pyarrow_numpy")
)
pd_arr = pd.core.arrays.string_arrow.ArrowStringArray._from_sequence(
pd_s, dtype=pd.StringDtype("pyarrow_numpy")
)

tm.assert_equal(cu_arr, pd_arr)
Loading