jonded94 commented on code in PR #45471: URL: https://github.com/apache/arrow/pull/45471#discussion_r1962058683
########## python/pyarrow/array.pxi: ########## @@ -1651,16 +1651,32 @@ cdef class Array(_PandasConvertible): array = array.copy() return array - def to_pylist(self): + def to_pylist(self, *, maps_as_pydicts=None): """ Convert to a list of native Python objects. + Parameters + ---------- + maps_as_pydicts : str, optional, default `None` + Valid values are `None`, 'lossy', or 'strict'. + The default behavior (`None`), is to convert Arrow Map arrays to + Python association lists (list-of-tuples) in the same order as the + Arrow Map, as in [(key1, value1), (key2, value2), ...]. + + If 'lossy' or 'strict', convert Arrow Map arrays to native Python dicts. + This can change the ordering of (key, value) pairs, and will + deduplicate multiple keys, resulting in a possible loss of data. Review Comment: Removed the ordering part, added some explanation of which value survives on duplicate keys. ########## python/pyarrow/table.pxi: ########## @@ -1349,10 +1349,26 @@ cdef class ChunkedArray(_PandasConvertible): for i in range(self.num_chunks): yield self.chunk(i) - def to_pylist(self): + def to_pylist(self, *, maps_as_pydicts=None): """ Convert to a list of native Python objects. + Parameters + ---------- + maps_as_pydicts : str, optional, default `None` + Valid values are `None`, 'lossy', or 'strict'. + The default behavior (`None`), is to convert Arrow Map arrays to + Python association lists (list-of-tuples) in the same order as the + Arrow Map, as in [(key1, value1), (key2, value2), ...]. + + If 'lossy' or 'strict', convert Arrow Map arrays to native Python dicts. + This can change the ordering of (key, value) pairs, and will Review Comment: Same as above -- 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