I was transforming categorical features using factorize()
function which returns a tuple of a cupy
array and strings. I assigned the cupy
array into a variable named codes
. However, I can't seem to get the unique values of codes
using codes.unique()
It returns an error message:
AttrubuteError: 'cupy.core.core.ndarray' object has no attribute 'unique'
# use factorize to create continuous integers from a categorical feature (returns a tuple)
codes, uniques = df_train['product_id'].factorize()
codes.unique()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-59-27db0fac06a1> in <module>()
----> 1 codes.unique()
AttributeError: 'cupy.core.core.ndarray' object has no attribute 'unique'
Appreciate the help and suggestion to make it work