dmatrix2np icon indicating copy to clipboard operation
dmatrix2np copied to clipboard

error: unpack requires a buffer of 1 bytes

Open jafarpenot opened this issue 2 years ago • 1 comments

Hi guys,

I got this error while trying to convert a dmatrix to a numpy array : error: unpack requires a buffer of 1 bytes

Here is my code:

`import os import xgboost as xgb from sklearn.model_selection import train_test_split from dmatrix2np import dmatrix_to_numpy

train, test = train_test_split(df, test_size=0.2)

dtrain = xgb.DMatrix(train.drop(columns={'default', 'types', 'iin', 'DATA_FLAG', 'type', 'requested_at', 'id'}), train['default']) dtest = xgb.DMatrix(test.drop(columns={'default', 'types', 'iin', 'DATA_FLAG', 'type', 'requested_at', 'id'}), test['default'])

converted_np_array = dmatrix_to_numpy(dtrain) ` Any idea on how to fix?

jafarpenot avatar Apr 22 '22 08:04 jafarpenot