def _arrayize_vectorized_indexer(indexer, shape):
    """ Return an identical vindex but slices are replaced by arrays """
    slices = [v for v in indexer.tuple if isinstance(v, slice)]
    if len(slices) == 0:
        return indexer

    arrays = [v for v in indexer.tuple if isinstance(v, np.ndarray)]
    n_dim = arrays[0].ndim if len(arrays) > 0 else 0
    i_dim = 0
    new_key = []
    for v, size in zip(indexer.tuple, shape):
        if isinstance(v, np.ndarray):
            new_key.append(np.reshape(v, v.shape + (1, ) * len(slices)))
        else:  # slice
            shape = ((1,) * (n_dim + i_dim) + (-1,) +
                     (1,) * (len(slices) - i_dim - 1))
            new_key.append(np.arange(*v.indices(size)).reshape(shape))
            i_dim += 1
    return VectorizedIndexer(tuple(new_key))
def _arrayize_vectorized_indexer ( indexer , shape ) : slices = [ v for v in indexer . tuple if isinstance ( v , slice ) ] if len ( slices ) == 0 : return indexer arrays = [ v for v in indexer . tuple if isinstance ( v , np . ndarray ) ] n_dim = arrays [ 0 ] . ndim if len ( arrays ) > 0 else 0 i_dim = 0 new_key = [ ] for v , size in zip ( indexer . tuple , shape ) : if isinstance ( v , np . ndarray ) : new_key . append ( np . reshape ( v , v . shape + ( 1 , ) * len ( slices ) ) ) else : shape = ( ( 1 , ) * ( n_dim + i_dim ) + ( - 1 , ) + ( 1 , ) * ( len ( slices ) - i_dim - 1 ) ) new_key . append ( np . arange ( * v . indices ( size ) ) . reshape ( shape ) ) i_dim += 1 return VectorizedIndexer ( tuple ( new_key ) )
Return an identical vindex but slices are replaced by arrays