| [ Web Proxy ] |
| Viewing: https://arrow.apache.org/docs/python/api/../generated/pyarrow.compute.fill_null.html | [Back] [Original] |
Section Navigation
Replace each null element in values with a corresponding element from fill_value.
If fill_value is scalar-like, then every null element in values will be replaced with fill_value. If fill_value is array-like, then the i-th element in values will be replaced with the i-th element in fill_value.
The fill_values type must be the same as that of values, or it must be able to be implicitly casted to the arrays type.
This is an alias for coalesce().
Values with all null elements replaced
Examples
>>> import pyarrow as pa
>>> arr = pa.array([1, 2, None, 3], type=pa.int8())
>>> fill_value = pa.scalar(5, type=pa.int8())
>>> arr.fill_null(fill_value)
<pyarrow.lib.Int8Array object at ...>
[
1,
2,
5,
3
]
>>> arr = pa.array([1, 2, None, 4, None])
>>> arr.fill_null(pa.array([10, 20, 30, 40, 50]))
<pyarrow.lib.Int64Array object at ...>
[
1,
2,
30,
4,
50
]
Copyright 2016-2026 Apache Software Foundation.
Apache Arrow, Arrow, Apache, the Apache logo, and the Apache Arrow project logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.
Created using Sphinx 9.1.0.
Built with the PyData Sphinx Theme 0.20.0.
| Web Proxy Viewer | New URL | Original Page |