(typ, val, c)
return NativeValue(dataframe._getvalue(), is_error=c.builder.load(errorptr))
unbox dataframe to an empty DataFrame struct
    columns will be extracted later if necessary.
unbox dataframe to an empty DataFrame struct
    columns will be extracted later if necessary.
unbox dataframe to an empty DataFrame struct columns will be extracted later if necessary .
def unbox_dataframe(typ, val, c):
    """unbox dataframe to an empty DataFrame struct
    columns will be extracted later if necessary.
    """
    n_cols = len(typ.columns)
    # create dataframe struct and store values
    dataframe = cgutils.create_struct_proxy(typ)(c.context, c.builder)

    errorptr = cgutils.alloca_once_value(c.builder, cgutils.false_bit)

    _, data_typs_map, types_order = get_structure_maps(typ.data, typ.columns)

    for col_typ in types_order:
        type_id, col_indices = data_typs_map[col_typ]
        n_type_cols = len(col_indices)
        list_type = types.List(col_typ)
        ok, inst = listobj.ListInstance.allocate_ex(c.context, c.builder, list_type, n_type_cols)

        with c.builder.if_else(ok, likely=True) as (if_ok, if_not_ok):
            with if_ok:
                inst.size = c.context.get_constant(types.intp, n_type_cols)
                for i, col_idx in enumerate(col_indices):
                    series_obj = c.pyapi.object_getattr_string(val, typ.columns[col_idx])
                    arr_obj = c.pyapi.object_getattr_string(series_obj, "values")
                    ty_series = typ.data[col_idx]

                    # FIXME: CategoricalType has wrong dtype attribute value (i.e. dtype of codes)
                    # current implementation offers pd_dtype for this purpose, so use it
                    column_dtype = ty_series.pd_dtype if isinstance(ty_series, Categorical) else ty_series.dtype
                    native_val = _unbox_series_data(column_dtype, ty_series, arr_obj, c)

                    inst.setitem(c.context.get_constant(types.intp, i), native_val.value, incref=False)
                    c.pyapi.decref(arr_obj)
                    c.pyapi.decref(series_obj)

                dataframe.data = c.builder.insert_value(dataframe.data, inst.value, type_id)

            with if_not_ok:
                c.builder.store(cgutils.true_bit, errorptr)

        # If an error occurred, drop the whole native list
        with c.builder.if_then(c.builder.load(errorptr)):
            c.context.nrt.decref(c.builder, list_type, inst.value)

    index_obj = c.pyapi.object_getattr_string(val, "index")
    dataframe.index = _unbox_index_data(typ.index, index_obj, c).value
    c.pyapi.decref(index_obj)

    dataframe.parent = val

    return NativeValue(dataframe._getvalue(), is_error=c.builder.load(errorptr))
def unbox_dataframe ( typ , val , c ) : n_cols = len ( typ . columns ) # create dataframe struct and store values dataframe = cgutils . create_struct_proxy ( typ ) ( c . context , c . builder ) errorptr = cgutils . alloca_once_value ( c . builder , cgutils . false_bit ) _ , data_typs_map , types_order = get_structure_maps ( typ . data , typ . columns ) for col_typ in types_order : type_id , col_indices = data_typs_map [ col_typ ] n_type_cols = len ( col_indices ) list_type = types . List ( col_typ ) ok , inst = listobj . ListInstance . allocate_ex ( c . context , c . builder , list_type , n_type_cols ) with c . builder . if_else ( ok , likely = True ) as ( if_ok , if_not_ok ) : with if_ok : inst . size = c . context . get_constant ( types . intp , n_type_cols ) for i , col_idx in enumerate ( col_indices ) : series_obj = c . pyapi . object_getattr_string ( val , typ . columns [ col_idx ] ) arr_obj = c . pyapi . object_getattr_string ( series_obj , "values" ) ty_series = typ . data [ col_idx ] # FIXME: CategoricalType has wrong dtype attribute value (i.e. dtype of codes) # current implementation offers pd_dtype for this purpose, so use it column_dtype = ty_series . pd_dtype if isinstance ( ty_series , Categorical ) else ty_series . dtype native_val = _unbox_series_data ( column_dtype , ty_series , arr_obj , c ) inst . setitem ( c . context . get_constant ( types . intp , i ) , native_val . value , incref = False ) c . pyapi . decref ( arr_obj ) c . pyapi . decref ( series_obj ) dataframe . data = c . builder . insert_value ( dataframe . data , inst . value , type_id ) with if_not_ok : c . builder . store ( cgutils . true_bit , errorptr ) # If an error occurred, drop the whole native list with c . builder . if_then ( c . builder . load ( errorptr ) ) : c . context . nrt . decref ( c . builder , list_type , inst . value ) index_obj = c . pyapi . object_getattr_string ( val , "index" ) dataframe . index = _unbox_index_data ( typ . index , index_obj , c ) . value c . pyapi . decref ( index_obj ) dataframe . parent = val return NativeValue ( dataframe . _getvalue ( ) , is_error = c . builder . load ( errorptr ) )