turicreate.Sketch.element_sub_sketch

Sketch.element_sub_sketch(keys=None)

Returns the sketch summary for the given set of keys. This is only applicable for sketch summary created from SArray of sarray or dict type. For dict SArray, the keys are the keys in dict value. For array Sarray, the keys are indexes into the array value.

The keys must be passed into original summary() call in order to be able to be retrieved later

Parameters:
keys : list of str | str | list of int | int

The list of dictionary keys or array index to get sub sketch from. if not given, then retrieve all sub sketches that are available

Returns:
A dictionary that maps from the key(index) to the actual sketch summary
for that key(index)

Examples

>>> sa = turicreate.SArray([{'a':1, 'b':2}, {'a':4, 'd':1}])
>>> s = sa.summary(sub_sketch_keys=['a','b'])
>>> s.element_sub_sketch(['a'])
{'a':
 +--------------------+-------+----------+
 |        item        | value | is exact |
 +--------------------+-------+----------+
 |       Length       |   2   |   Yes    |
 |        Min         |  1.0  |   Yes    |
 |        Max         |  4.0  |   Yes    |
 |        Mean        |  2.5  |   Yes    |
 |        Sum         |  5.0  |   Yes    |
 |      Variance      |  2.25 |   Yes    |
 | Standard Deviation |  1.5  |   Yes    |
 |  # Missing Values  |   0   |   Yes    |
 |  # unique values   |   2   |    No    |
 +--------------------+-------+----------+
 Most frequent items:
 +-------+-----+-----+
 | value | 1.0 | 4.0 |
 +-------+-----+-----+
 | count |  1  |  1  |
 +-------+-----+-----+
 Quantiles:
 +-----+-----+-----+-----+-----+-----+-----+-----+------+
 |  0% |  1% |  5% | 25% | 50% | 75% | 95% | 99% | 100% |
 +-----+-----+-----+-----+-----+-----+-----+-----+------+
 | 1.0 | 1.0 | 1.0 | 1.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0  |
 +-----+-----+-----+-----+-----+-----+-----+-----+------+}