pyarrow.float16

pyarrow.float16()

Create half-precision floating point type.

Examples

Create an instance of float16 type:

>>> import pyarrow as pa
>>> pa.float16()
DataType(halffloat)
>>> print(pa.float16())
halffloat

Create an array with float16 type:

>>> arr = np.array([1.5, np.nan], dtype=np.float16)
>>> a = pa.array(arr, type=pa.float16())
>>> a
<pyarrow.lib.HalfFloatArray object at ...>
[
  15872,
  32256
]
>>> a.to_pylist()
[1.5, nan]