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

Function test_table_maps_as_pydicts

python/pyarrow/tests/test_table.py:1907–1924  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1905
1906
1907def test_table_maps_as_pydicts():
1908 arrays = [
1909 pa.array(
1910 [{'x': 1, 'y': 2}, {'z': 3}],
1911 type=pa.map_(pa.string(), pa.int32())
1912 )
1913 ]
1914 table = pa.Table.from_arrays(arrays, names=['a'])
1915
1916 table_dict = table.to_pydict(maps_as_pydicts="strict")
1917 assert 'a' in table_dict
1918 column_list = table_dict['a']
1919 assert len(column_list) == 2
1920 assert column_list == [{'x': 1, 'y': 2}, {'z': 3}]
1921
1922 table_list = table.to_pylist(maps_as_pydicts="strict")
1923 assert len(table_list) == 2
1924 assert table_list == [{'a': {'x': 1, 'y': 2}}, {'a': {'z': 3}}]
1925
1926
1927def test_concat_tables():

Callers

nothing calls this directly

Calls 3

lenFunction · 0.85
arrayMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected