def __getitem__(self, index):
        """
        Get an item from the array through indexing.

        Supports basic indexing with slices and ints, or advanced
        indexing with lists or ndarrays of integers.
        Mixing basic and advanced indexing across axes is currently supported
        only for a single advanced index amidst multiple basic indices.

        Parameters
        ----------
        index : tuple of slices, ints, list, tuple, or ndarrays
            One or more index specifications

        Returns
        -------
        BoltSparkArray
        """
        if isinstance(index, tuple):
            index = list(index)
        else:
            index = [index]
        int_locs = where([isinstance(i, int) for i in index])[0]

        if len(index) > self.ndim:
            raise ValueError("Too many indices for array")

        if not all([isinstance(i, (slice, int, list, tuple, ndarray)) for i in index]):
            raise ValueError("Each index must either be a slice, int, list, set, or ndarray")

        # fill unspecified axes with full slices
        if len(index) < self.ndim:
            index += tuple([slice(0, None, None) for _ in range(self.ndim - len(index))])

        # standardize slices and bounds checking
        for n, idx in enumerate(index):
            size = self.shape[n]
            if isinstance(idx, (slice, int)):
                slc = slicify(idx, size)
                # throw an error if this would lead to an empty dimension in numpy
                if slc.step > 0:
                    minval, maxval = slc.start, slc.stop
                else:
                    minval, maxval = slc.stop, slc.start
                if minval > size-1 or maxval < 1 or minval >= maxval:
                    raise ValueError("Index {} in dimension {} with shape {} would "
                                     "produce an empty dimension".format(idx, n, size))
                index[n] = slc
            else:
                adjusted = array(idx)
                inds = where(adjusted<0)
                adjusted[inds] += size
                if adjusted.min() < 0 or adjusted.max() > size-1:
                    raise ValueError("Index {} out of bounds in dimension {} with "
                                     "shape {}".format(idx, n, size))
                index[n] = adjusted

        # select basic or advanced indexing
        if all([isinstance(i, slice) for i in index]):
            rdd, shape, split = self._getbasic(index)
        elif all([isinstance(i, (tuple, list, ndarray)) for i in index]):
            rdd, shape, split = self._getadvanced(index)
        elif sum([isinstance(i, (tuple, list, ndarray)) for i in index]) == 1:
            rdd, shape, split = self._getmixed(index)
        else:
            raise NotImplementedError("When mixing basic indexing (slices and int) with "
                                      "with advanced indexing (lists, tuples, and ndarrays), "
                                      "can only have a single advanced index")

        # if any key indices used negative steps, records are no longer ordered
        if self._ordered is False or any([isinstance(s, slice) and s.step<0 for s in index[:self.split]]):
            ordered = False
        else:
            ordered = True

        result = self._constructor(rdd, shape=shape, split=split, ordered=ordered).__finalize__(self)

        # squeeze out int dimensions (and squeeze to singletons if all ints)
        if len(int_locs) == self.ndim:
            return result.squeeze().toarray()[()]
        else:
            return result.squeeze(tuple(int_locs))
def __getitem__ ( self , index ) : if isinstance ( index , tuple ) : index = list ( index ) else : index = [ index ] int_locs = where ( [ isinstance ( i , int ) for i in index ] ) [ 0 ] if len ( index ) > self . ndim : raise ValueError ( "Too many indices for array" ) if not all ( [ isinstance ( i , ( slice , int , list , tuple , ndarray ) ) for i in index ] ) : raise ValueError ( "Each index must either be a slice, int, list, set, or ndarray" ) if len ( index ) < self . ndim : index += tuple ( [ slice ( 0 , None , None ) for _ in range ( self . ndim - len ( index ) ) ] ) for n , idx in enumerate ( index ) : size = self . shape [ n ] if isinstance ( idx , ( slice , int ) ) : slc = slicify ( idx , size ) if slc . step > 0 : minval , maxval = slc . start , slc . stop else : minval , maxval = slc . stop , slc . start if minval > size - 1 or maxval < 1 or minval >= maxval : raise ValueError ( "Index {} in dimension {} with shape {} would " "produce an empty dimension" . format ( idx , n , size ) ) index [ n ] = slc else : adjusted = array ( idx ) inds = where ( adjusted < 0 ) adjusted [ inds ] += size if adjusted . min ( ) < 0 or adjusted . max ( ) > size - 1 : raise ValueError ( "Index {} out of bounds in dimension {} with " "shape {}" . format ( idx , n , size ) ) index [ n ] = adjusted if all ( [ isinstance ( i , slice ) for i in index ] ) : rdd , shape , split = self . _getbasic ( index ) elif all ( [ isinstance ( i , ( tuple , list , ndarray ) ) for i in index ] ) : rdd , shape , split = self . _getadvanced ( index ) elif sum ( [ isinstance ( i , ( tuple , list , ndarray ) ) for i in index ] ) == 1 : rdd , shape , split = self . _getmixed ( index ) else : raise NotImplementedError ( "When mixing basic indexing (slices and int) with " "with advanced indexing (lists, tuples, and ndarrays), " "can only have a single advanced index" ) if self . _ordered is False or any ( [ isinstance ( s , slice ) and s . step < 0 for s in index [ : self . split ] ] ) : ordered = False else : ordered = True result = self . _constructor ( rdd , shape = shape , split = split , ordered = ordered ) . __finalize__ ( self ) if len ( int_locs ) == self . ndim : return result . squeeze ( ) . toarray ( ) [ ( ) ] else : return result . squeeze ( tuple ( int_locs ) )
Get an item from the array through indexing.

        Supports basic indexing with slices and ints, or advanced
        indexing with lists or ndarrays of integers.
        Mixing basic and advanced indexing across axes is currently supported
        only for a single advanced index amidst multiple basic indices.

        Parameters
        ----------
        index : tuple of slices, ints, list, tuple, or ndarrays
            One or more index specifications

        Returns
        -------
        BoltSparkArray