Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit bc0c1ec

Browse files
committed
Change boxing of DataFrame.data
1 parent e059436 commit bc0c1ec

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

sdc/hiframes/boxing.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -234,29 +234,13 @@ def box_dataframe(typ, val, c):
234234

235235
# extracting list from the tuple
236236
list_val = builder.extract_value(dataframe.data, type_id)
237-
typ_arrs = listobj.ListInstance(context, builder, list_type, list_val)
238237
# getting array from the list to box it then
239-
arr = typ_arrs.getitem(col_id)
240-
typ_arrs.incref_value(arr)
241-
242-
if dtype == string_type:
243-
arr_obj = box_str_arr(arr_typ, arr, c)
244-
elif isinstance(dtype, PDCategoricalDtype):
245-
arr_obj = box_categorical_array(arr_typ, arr, c)
246-
# context.nrt.incref(builder, arr_typ, arr)
247-
elif dtype == types.List(string_type):
248-
arr_obj = box_list(list_string_array_type, arr, c)
249-
# context.nrt.incref(builder, arr_typ, arr) # TODO required?
250-
# pyapi.print_object(arr_obj)
251-
else:
252-
arr_obj = box_array(arr_typ, arr, c)
253-
# TODO: is incref required?
254-
# context.nrt.incref(builder, arr_typ, arr)
238+
typ_arrs = box_list(list_type, list_val, c)
239+
# PyList_GetItem returns borrowed reference
240+
arr_obj = pyapi.list_getitem(typ_arrs, col_id)
255241
pyapi.dict_setitem(df_dict, cname_obj, arr_obj)
256242

257-
if c.context.enable_nrt:
258-
c.context.nrt.decref(c.builder, list_type, list_val)
259-
pyapi.decref(arr_obj)
243+
pyapi.decref(typ_arrs)
260244
pyapi.decref(cname_obj)
261245

262246
df_obj = pyapi.call_method(class_obj, "DataFrame", (df_dict,))

0 commit comments

Comments
 (0)