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

Function test_list_element

python/pyarrow/tests/test_compute.py:3896–3911  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3894
3895
3896def test_list_element():
3897 element_type = pa.struct([('a', pa.float64()), ('b', pa.int8())])
3898 list_type = pa.list_(element_type)
3899 l1 = [{'a': .4, 'b': 2}, None, {'a': .2, 'b': 4}, None, {'a': 5.6, 'b': 6}]
3900 l2 = [None, {'a': .52, 'b': 3}, {'a': .7, 'b': 4}, None, {'a': .6, 'b': 8}]
3901 lists = pa.array([l1, l2], list_type)
3902
3903 index = 1
3904 result = pa.compute.list_element(lists, index)
3905 expected = pa.array([None, {'a': 0.52, 'b': 3}], element_type)
3906 assert result.equals(expected)
3907
3908 index = 4
3909 result = pa.compute.list_element(lists, index)
3910 expected = pa.array([{'a': 5.6, 'b': 6}, {'a': .6, 'b': 8}], element_type)
3911 assert result.equals(expected)
3912
3913
3914def test_count_distinct():

Callers

nothing calls this directly

Calls 2

equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected