AlenkaF commented on issue #37517:
URL: https://github.com/apache/arrow/issues/37517#issuecomment-1715356785
Sorry, I can not seem to create an example to reproduce the issue.
Tried with dev version of `pyarrow`:
```python
(pyarrow-dev) alenkafrim@Alenkas-MacBook-Pro python % python
Python 3.10.10 (main, Feb 16 2023, 02:46:59) [Clang 14.0.0
(clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyarrow as pa
>>> pa.__version__
'14.0.0.dev42+g1af709ff9.d20230830'
>>> data = [[{'key': 'a', 'value': "1"}, {'key': 'b', 'value': "2"}],
[{'key': 'c', 'value': "3"}]]
>>> map_type = pa.map_(pa.string(), pa.string())
>>> inner_map = pa.array(data, type=map_type)
>>> inner_list = pa.ListArray.from_arrays([0, 1, 2], inner_map)
>>> array = pa.MapArray.from_arrays([0, 1, 2], ["First", "Second"],
inner_list)
>>> table = pa.table({'array_element': array})
>>> table.schema
array_element: map<string, list<item: map<string, string>>>
child 0, entries: struct<key: string not null, value: list<item:
map<string, string>>> not null
child 0, key: string not null
child 1, value: list<item: map<string, string>>
child 0, item: map<string, string>
child 0, entries: struct<key: string not null, value: string>
not null
child 0, key: string not null
child 1, value: string
>>> table.to_pandas()
array_element
0 [(First, [[('a', '1'), ('b', '2')]])]
1 [(Second, [[('c', '3')]])]
```
```python
>>> table = pa.table({'array_element': inner_list})
>>> table.schema
array_element: list<item: map<string, string>>
child 0, item: map<string, string>
child 0, entries: struct<key: string not null, value: string> not null
child 0, key: string not null
child 1, value: string
>>> table.to_pandas()
array_element
0 [[(a, 1), (b, 2)]]
1 [[(c, 3)]]
```
Can you check which column is giving you the error? Also, does the code
above work for you?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]