Summary statistics that can be calculated with one pass over the SArray.

        Returns a turicreate.Sketch object which can be further queried for many
        descriptive statistics over this SArray. Many of the statistics are
        approximate. See the :class:`~turicreate.Sketch` documentation for more
        detail.

        Parameters
        ----------
        background : boolean, optional
          If True, the sketch construction will return immediately and the
          sketch will be constructed in the background. While this is going on,
          the sketch can be queried incrementally, but at a performance penalty.
          Defaults to False.

        sub_sketch_keys : int | str | list of int | list of str, optional
            For SArray of dict type, also constructs sketches for a given set of keys,
            For SArray of array type, also constructs sketches for the given indexes.
            The sub sketches may be queried using: :py:func:`~turicreate.Sketch.element_sub_sketch()`.
            Defaults to None in which case no subsketches will be constructed.

        Returns
        -------
        out : Sketch
            Sketch object that contains descriptive statistics for this SArray.
            Many of the statistics are approximate.

def summary(self, background=False, sub_sketch_keys=None):
        """
        Summary statistics that can be calculated with one pass over the SArray.

        Returns a turicreate.Sketch object which can be further queried for many
        descriptive statistics over this SArray. Many of the statistics are
        approximate. See the :class:`~turicreate.Sketch` documentation for more
        detail.

        Parameters
        ----------
        background : boolean, optional
          If True, the sketch construction will return immediately and the
          sketch will be constructed in the background. While this is going on,
          the sketch can be queried incrementally, but at a performance penalty.
          Defaults to False.

        sub_sketch_keys : int | str | list of int | list of str, optional
            For SArray of dict type, also constructs sketches for a given set of keys,
            For SArray of array type, also constructs sketches for the given indexes.
            The sub sketches may be queried using: :py:func:`~turicreate.Sketch.element_sub_sketch()`.
            Defaults to None in which case no subsketches will be constructed.

        Returns
        -------
        out : Sketch
            Sketch object that contains descriptive statistics for this SArray.
            Many of the statistics are approximate.
        """
        from ..data_structures.sketch import Sketch
        if (self.dtype == _Image):
            raise TypeError("summary() is not supported for arrays of image type")
        if (type(background) != bool):
            raise TypeError("'background' parameter has to be a boolean value")
        if (sub_sketch_keys is not None):
            if (self.dtype != dict and self.dtype != array.array):
                raise TypeError("sub_sketch_keys is only supported for SArray of dictionary or array type")
            if not _is_non_string_iterable(sub_sketch_keys):
                sub_sketch_keys = [sub_sketch_keys]
            value_types = set([type(i) for i in sub_sketch_keys])
            if (len(value_types) != 1):
                raise ValueError("sub_sketch_keys member values need to have the same type.")
            value_type = value_types.pop()
            if (self.dtype == dict and value_type != str):
                raise TypeError("Only string value(s) can be passed to sub_sketch_keys for SArray of dictionary type. "+
                    "For dictionary types, sketch summary is computed by casting keys to string values.")
            if (self.dtype == array.array and value_type != int):
                raise TypeError("Only int value(s) can be passed to sub_sketch_keys for SArray of array type")
        else:
            sub_sketch_keys = list()

        return Sketch(self, background, sub_sketch_keys = sub_sketch_keys)