def _outer_to_vectorized_indexer(key, shape):
    """Convert an OuterIndexer into an vectorized indexer.

    Parameters
    ----------
    key : Outer/Basic Indexer
        An indexer to convert.
    shape : tuple
        Shape of the array subject to the indexing.

    Returns
    -------
    VectorizedIndexer
        Tuple suitable for use to index a NumPy array with vectorized indexing.
        Each element is an array: broadcasting them together gives the shape
        of the result.
    """
    key = key.tuple

    n_dim = len([k for k in key if not isinstance(k, integer_types)])
    i_dim = 0
    new_key = []
    for k, size in zip(key, shape):
        if isinstance(k, integer_types):
            new_key.append(np.array(k).reshape((1,) * n_dim))
        else:  # np.ndarray or slice
            if isinstance(k, slice):
                k = np.arange(*k.indices(size))
            assert k.dtype.kind in {'i', 'u'}
            shape = [(1,) * i_dim + (k.size, ) +
                     (1,) * (n_dim - i_dim - 1)]
            new_key.append(k.reshape(*shape))
            i_dim += 1
    return VectorizedIndexer(tuple(new_key))
def _outer_to_vectorized_indexer ( key , shape ) : key = key . tuple n_dim = len ( [ k for k in key if not isinstance ( k , integer_types ) ] ) i_dim = 0 new_key = [ ] for k , size in zip ( key , shape ) : if isinstance ( k , integer_types ) : new_key . append ( np . array ( k ) . reshape ( ( 1 , ) * n_dim ) ) else : if isinstance ( k , slice ) : k = np . arange ( * k . indices ( size ) ) assert k . dtype . kind in { 'i' , 'u' } shape = [ ( 1 , ) * i_dim + ( k . size , ) + ( 1 , ) * ( n_dim - i_dim - 1 ) ] new_key . append ( k . reshape ( * shape ) ) i_dim += 1 return VectorizedIndexer ( tuple ( new_key ) )
Convert an OuterIndexer into an vectorized indexer.

    Parameters
    ----------
    key : Outer/Basic Indexer
        An indexer to convert.
    shape : tuple
        Shape of the array subject to the indexing.

    Returns
    -------
    VectorizedIndexer
        Tuple suitable for use to index a NumPy array with vectorized indexing.
        Each element is an array: broadcasting them together gives the shape
        of the result.