ianmcook opened a new issue, #41684:
URL: https://github.com/apache/arrow/issues/41684
### Describe the bug, including details regarding any error messages,
version, and platform.
I have a MapArray created like this:
```py
table = pa.table(
{"m": [{"a": 1}, {}, None, {"b": None}]},
schema=pa.schema([pa.field("m", pa.map_(pa.string(), pa.int64()), True)])
)
m = table["m"].chunks[0]
```
Notice that the value at position 2 is null:
```py
m.to_pandas()
## 0 [(a, 1.0)]
## 1 []
## 2 None
## 3 [(b, None)]
## dtype: object
m.is_null()
## <pyarrow.lib.BooleanArray object at 0x1637cb220>
## [
## false,
## false,
## true,
## false
## ]
```
I am trying to reconstruct the MapArray from its constituent arrays, but
when I do this, it always loses the null:
```py
new = pa.MapArray.from_arrays(m.offsets, m.keys, m.items, m.type)
new.to_pandas()
## 0 [(a, 1.0)]
## 1 []
## 2 []
## 3 [(b, None)]
## dtype: object
new.is_null()
## <pyarrow.lib.BooleanArray object at 0x1637cb220>
## [
## false,
## false,
## false,
## false
## ]
```
Wrapping `pa.array(..., mask=m.is_null())` around it does not help either.
Is there any way to reconstruct the MapArray and keep the null?
### Component(s)
Python
--
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]