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

Function test_dictionary_from_boxed_arrays

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

Source from the content-addressed store, hash-verified

1083
1084@pytest.mark.numpy
1085def test_dictionary_from_boxed_arrays():
1086 indices = np.repeat([0, 1, 2], 2)
1087 dictionary = np.array(['foo', 'bar', 'baz'], dtype=object)
1088
1089 iarr = pa.array(indices)
1090 darr = pa.array(dictionary)
1091
1092 d1 = pa.DictionaryArray.from_arrays(iarr, darr)
1093
1094 assert d1.indices.to_pylist() == indices.tolist()
1095 assert d1.dictionary.to_pylist() == dictionary.tolist()
1096
1097 for i in range(len(indices)):
1098 assert d1[i].as_py() == dictionary[indices[i]]
1099
1100
1101def test_dictionary_from_arrays_boundscheck():

Callers

nothing calls this directly

Calls 3

lenFunction · 0.85
as_pyMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected