spenczar opened a new issue, #35624:
URL: https://github.com/apache/arrow/issues/35624

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Suppose you have a fixed-sized list array with null values:
   
   ```py
   array = pa.nulls(3, pa.list_(pa.float64(), 2))
   print(array)
   # [
   #  null,
   #  null,
   #  null
   #]
   ```
   
   How do you fill the nulls? Like, maybe I want it to look like `[[null, 
null], [null, null], [null, null]]`. Or even `[[0, 0], [0, 0], [0, 0]]`.
   
   You can't call `fill_null` with a pyarrow array value, because the arrays 
don't have an '`as_py`' method:
   ```py
   array.fill_null(pa.array([0.0, 0.0]))
   ```
   ```
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "pyarrow/array.pxi", line 1296, in pyarrow.lib.Array.fill_null
     File 
"/Users/swnelson/scratch/.arrow-venv/lib/python3.11/site-packages/pyarrow/compute.py",
 line 523, in fill_null
       fill_value = pa.scalar(fill_value.as_py(), type=values.type)
                              ^^^^^^^^^^^^^^^^
   AttributeError: 'pyarrow.lib.DoubleArray' object has no attribute 'as_py'
   ```
   
   But you _can_ do it with a plain old Python list!
   
   ```py
   array.fill_null([0.0, 0.0])
   ```
   ```
   <pyarrow.lib.FixedSizeListArray object at 0x135647460>
   [
     [
       0,
       0
     ],
     [
       0,
       0
     ],
     [
       0,
       0
     ]
   ]
   ```
   
   This seems like an oversight. If I give an array of the right shape, surely 
it should be permitted.
   
   ### 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]

Reply via email to