| [ Web Proxy ] |
| Viewing: https://arrow.apache.org/docs/python/generated/pyarrow.binary.html | [Back] [Original] |
Section Navigation
Create variable-length or fixed size binary type.
int, optional, default -1If length == -1 then return a variable length binary type. If length is greater than or equal to 0 then return a fixed size binary type of width length.
Examples
Create an instance of a variable-length binary type:
>>> import pyarrow as pa
>>> pa.binary()
DataType(binary)
and use the variable-length binary type to create an array:
>>> pa.array(['foo', 'bar', 'baz'], type=pa.binary())
<pyarrow.lib.BinaryArray object at ...>
[
666F6F,
626172,
62617A
]
Create an instance of a fixed-size binary type:
>>> pa.binary(3)
FixedSizeBinaryType(fixed_size_binary[3])
and use the fixed-length binary type to create an array:
>>> pa.array(['foo', 'bar', 'baz'], type=pa.binary(3))
<pyarrow.lib.FixedSizeBinaryArray object at ...>
[
666F6F,
626172,
62617A
]
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 |