I am trying to use melt()
function but it is showing me an error for passing 2 argument, which really weird because i am passing id
as an argument and in my DataFrame i have only one id
column, Although this error only comes when i use data which split from dataset by train_test_split
function otherwise it is working fine.
error message:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-676-bfd6b4109c81> in <module>
1 # melt into long form
----> 2 X_train = X_train.melt('id')
3
4 # group on melted id for idxmax/mean per "row"
5 g = X_train.groupby('id').value
TypeError: melt() takes 1 positional argument but 2 were given
here X_train is a cudf DataFrame
.
The positional parameter is self
, which is X_train
. melt
expects its parameters to be specified by keyword. Try X_train.melt(id_vars=['id'])
.