drin commented on issue #14116: URL: https://github.com/apache/arrow/issues/14116#issuecomment-1247235473
I believe the problem is that you are incorrectly providing data to `from_pylist` and you are incorrectly structuring the data for `tags`. Here is a code snippet that I think does what you're looking for: ```python from pyarrow import Table from pyarrow import int64, map_, schema, string, field def test_map_type(): # 2 column schema; a map array is a list of tuples pyarrow_schema = schema([ field('id' , int64() , False) ,field('tags', map_(string(), string()), False) ]) # each row should have: <key count> <= <column count> first_row ={ 'id' : 1 ,'tags': [ ('tag1', 'value1') ,('tag2', 'value2' ) ] } second_row = { 'id' : 2 ,'tags': [ ('tag1', 'value1') ,('tag2', 'value2' ) ] } tags_updated = [first_row, second_row] table = Table.from_pylist(mapping=tags_updated, schema=pyarrow_schema) print(table.to_pydict()) test_map_type() ``` output: ```bash >> python test.py {'id': [1, 2], 'tags': [[('tag1', 'value1'), ('tag2', 'value2')], [('tag1', 'value1'), ('tag2', 'value2')]]} ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org