| 1905 | |
| 1906 | |
| 1907 | def 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 | |
| 1927 | def test_concat_tables(): |