我试过 pivot
和 groupby + unstack
,两者都给了我错误。
错误说
"Unstacked DataFrame is too big, causing int32 overflow".
我试图降级
pandas
至 0.21
但它与 python 3.7
不兼容,所以有什么解决办法吗?user_by_movie= user_items.groupby(['user_id', 'movie_id'])['rating'].min().unstack()
最佳答案
回答
这应该有效,让我知道。user_by_movie= user_items.groupby(['user_id', 'movie_id'])['rating'].min().to_frame()
关于python-3.x - 大数据集,使用 unstack() 时收到 "Unstacked DataFrame is too big, causing int32 overflow",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60961627/