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

Commit 5dd9ea0

Browse files
authored
Improve boxing (#832)
1 parent e4d2e06 commit 5dd9ea0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sdc/hiframes/boxing.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def box_dataframe(typ, val, c):
215215

216216
mod_name = context.insert_const_string(c.builder.module, "pandas")
217217
class_obj = pyapi.import_module_noblock(mod_name)
218-
df_obj = pyapi.call_method(class_obj, "DataFrame", ())
218+
df_dict = pyapi.dict_new()
219219

220220
for i, cname, arr, arr_typ, dtype in zip(range(n_cols), col_names, col_arrs, arr_typs, dtypes):
221221
# df['cname'] = boxed_arr
@@ -236,11 +236,14 @@ def box_dataframe(typ, val, c):
236236
arr_obj = box_array(arr_typ, arr, c)
237237
# TODO: is incref required?
238238
# context.nrt.incref(builder, arr_typ, arr)
239-
pyapi.object_setitem(df_obj, cname_obj, arr_obj)
239+
pyapi.dict_setitem(df_dict, cname_obj, arr_obj)
240240

241241
# pyapi.decref(arr_obj)
242242
pyapi.decref(cname_obj)
243243

244+
df_obj = pyapi.call_method(class_obj, "DataFrame", (df_dict,))
245+
pyapi.decref(df_dict)
246+
244247
# set df.index if necessary
245248
if typ.index != types.none:
246249
arr_obj = _box_series_data(typ.index.dtype, typ.index, dataframe.index, c)

0 commit comments

Comments
 (0)