MCPcopy Create free account
hub / github.com/apache/arrow / test_dictionary_uint64_index_to_pandas

Function test_dictionary_uint64_index_to_pandas

python/pyarrow/tests/test_array.py:4744–4751  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4742
4743@pytest.mark.pandas
4744def test_dictionary_uint64_index_to_pandas():
4745 # GH-37476: uint64 dictionary indices are preserved, and converting them to pandas
4746 # maps the indices to int64 categorical codes, which is safe because the indices are
4747 # bounded by the dictionary length.
4748 arr = pa.array(["a", "b", None, "a"], type=pa.dictionary(pa.uint64(), pa.string()))
4749 result = arr.to_pandas()
4750 assert list(result.cat.categories) == ["a", "b"]
4751 assert result.cat.codes.tolist() == [0, 1, -1, 0]
4752
4753
4754@pytest.mark.parametrize("op", [

Callers

nothing calls this directly

Calls 4

listFunction · 0.85
arrayMethod · 0.45
dictionaryMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected