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?
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?