turicreate.SArray.dict_keys

SArray.dict_keys()

Create an SArray that contains all the keys from each dictionary element as a list. Fails on SArrays whose data type is not dict.

Returns:
out : SArray

A SArray of list type, where each element is a list of keys from the input SArray element.

See also

dict_values

Examples

>>> sa = turicreate.SArray([{"this":1, "is":5, "dog":7},
                          {"this": 2, "are": 1, "cat": 5}])
>>> sa.dict_keys()
dtype: list
Rows: 2
[['this', 'is', 'dog'], ['this', 'are', 'cat']]