turicreate.SArray.from_const¶
-
classmethod
SArray.
from_const
(value, size, dtype=<class 'NoneType'>)¶ Constructs an SArray of size with a const value.
Parameters: - value : [int | float | str | array.array | list | dict | datetime]
The value to fill the SArray
- size : int
The size of the SArray
- dtype : type
The type of the SArray. If not specified, is automatically detected from the value. This should be specified if value=None since the actual type of the SArray can be anything.
Examples
Construct an SArray consisting of 10 zeroes:
>>> turicreate.SArray.from_const(0, 10)
Construct an SArray consisting of 10 missing string values:
>>> turicreate.SArray.from_const(None, 10, str)