| [ Web Proxy ] |
| Viewing: https://arrow.apache.org/docs/python/generated/pyarrow.repeat.html | [Back] [Original] |
Section Navigation
Create an Array instance whose slots are the given scalar.
Either a pyarrow.Scalar or any python object coercible to a Scalar.
intNumber of times to repeat the scalar in the output Array.
MemoryPool, default NoneArrow MemoryPool to use for allocations. Uses the default memory pool if not passed.
ArrayExamples
>>> import pyarrow as pa
>>> pa.repeat(10, 3)
<pyarrow.lib.Int64Array object at ...>
[
10,
10,
10
]
>>> pa.repeat([1, 2], 2)
<pyarrow.lib.ListArray object at ...>
[
[
1,
2
],
[
1,
2
]
]
>>> pa.repeat("string", 3)
<pyarrow.lib.StringArray object at ...>
[
"string",
"string",
"string"
]
>>> pa.repeat(pa.scalar({'a': 1, 'b': [1, 2]}), 2)
<pyarrow.lib.StructArray object at ...>
-- is_valid: all not null
-- child 0 type: int64
[
1,
1
]
-- child 1 type: list<item: int64>
[
[
1,
2
],
[
1,
2
]
]
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 |