turicreate.SArrayBuilder¶
-
class
turicreate.
SArrayBuilder
(dtype, num_segments=1, history_size=10)¶ An interface to incrementally build an SArray element by element.
Once closed, the SArray cannot be “reopened” using this interface.
Parameters: - dtype : type
The type of the elements in the SArray.
- num_segments : int, optional
Number of segments that can be written in parallel.
- history_size : int, optional
The number of elements to be cached as history. Caches the last history_size elements added with append or append_multiple.
Returns: - out : SArrayBuilder
Examples
>>> from turicreate import SArrayBuilder
>>> sb = SArrayBuilder(int)
>>> sb.append(1)
>>> sb.append_multiple([2,3])
>>> sb.close() dtype: int Rows: 3 [1, 2, 3]
Methods
SArrayBuilder.append (data[, segment]) |
Append a single element to an SArray. |
SArrayBuilder.append_multiple (data[, segment]) |
Append multiple elements to an SArray. |
SArrayBuilder.close () |
Creates an SArray from all values that were appended to the SArrayBuilder. |
SArrayBuilder.get_type () |
The type the result SArray will be if close is called. |
SArrayBuilder.read_history ([num, segment]) |
Outputs the last num elements that were appended either by append or append_multiple. |