pyarrow.scalar#
- pyarrow.scalar(value,type=None,*,from_pandas=None,MemoryPoolmemory_pool=None)#
Create a pyarrow.Scalar instance from a Python object.
- Parameters:
- value
Any Python object coercible to arrow’s type system.
- type
pyarrow.DataType Explicit type to attempt to coerce to, otherwise will be inferred fromthe value.
- from_pandasbool, default
None Use pandas’s semantics for inferring nulls from values inndarray-like data. Defaults to False if not passed explicitly by user,or True if a pandas object is passed in.
- memory_pool
pyarrow.MemoryPool, optional If not passed, will allocate memory from the currently-set defaultmemory pool.
- value
- Returns:
- scalar
pyarrow.Scalar
- scalar
Examples
>>>importpyarrowaspa
>>>pa.scalar(42)<pyarrow.Int64Scalar: 42>
>>>pa.scalar("string")<pyarrow.StringScalar: 'string'>
>>>pa.scalar([1,2])<pyarrow.ListScalar: [1, 2]>
>>>pa.scalar([1,2],type=pa.list_(pa.int16()))<pyarrow.ListScalar: [1, 2]>
On this page

