Esempio n. 1
0
def box_positional_index(typ, val, c):

    positional_index = numba.core.cgutils.create_struct_proxy(typ)(c.context,
                                                                   c.builder,
                                                                   val)
    data_range_index = numba.core.cgutils.create_struct_proxy(typ.data)(
        c.context, c.builder, positional_index.data)
    return box_range_index(typ.data, data_range_index._getvalue(), c)
Esempio n. 2
0
def _box_index_data(index_typ, val, c):
    """ Boxes native value used to represent Pandas index into appropriate Python object.
        Params:
            index_typ: Numba type of native value
            val: native value
            c: LLVM context object
        Returns: Python object native value is boxed into
    """
    assert isinstance(index_typ, (RangeIndexType, StringArrayType, types.Array, types.NoneType))

    if isinstance(index_typ, RangeIndexType):
        index = box_range_index(index_typ, val, c)
    elif isinstance(index_typ, types.Array):
        index = box_array(index_typ, val, c)
    elif isinstance(index_typ, StringArrayType):
        index = box_str_arr(string_array_type, val, c)
    else:  # index_typ is types.none
        index = c.pyapi.make_none()

    return index