MetaRec icon indicating copy to clipboard operation
MetaRec copied to clipboard

Inappropriate parameters for pandas preprocessing data

Open ntvviktor opened this issue 3 months ago • 0 comments

https://github.com/khanhnamle1994/MetaRec/blob/master/Autoencoders-Experiments/CDAE-PyTorch/DataUtils.py at line 55, 56

num_items_by_user = data.groupby('user', as_index=False).size()
num_users_by_item = data.groupby('item', as_index=False).size()

Does the as_index should be set to True because the later convert to pandas dataframe user_frame = num_items_by_user.to_frame() and assign columns name user_frame.columns = ['item_cnt'] as only as_index=True will result in a pandas Series, otherwise it already be a dataframe so cannot be converted?

ntvviktor avatar Apr 01 '24 02:04 ntvviktor