| 1952 | |
| 1953 | |
| 1954 | def test_table_maps_as_pydicts(): |
| 1955 | arrays = [ |
| 1956 | pa.array( |
| 1957 | [{'x': 1, 'y': 2}, {'z': 3}], |
| 1958 | type=pa.map_(pa.string(), pa.int32()) |
| 1959 | ) |
| 1960 | ] |
| 1961 | table = pa.Table.from_arrays(arrays, names=['a']) |
| 1962 | |
| 1963 | table_dict = table.to_pydict(maps_as_pydicts="strict") |
| 1964 | assert 'a' in table_dict |
| 1965 | column_list = table_dict['a'] |
| 1966 | assert len(column_list) == 2 |
| 1967 | assert column_list == [{'x': 1, 'y': 2}, {'z': 3}] |
| 1968 | |
| 1969 | table_list = table.to_pylist(maps_as_pydicts="strict") |
| 1970 | assert len(table_list) == 2 |
| 1971 | assert table_list == [{'a': {'x': 1, 'y': 2}}, {'a': {'z': 3}}] |
| 1972 | |
| 1973 | |
| 1974 | def test_concat_tables(): |