Just for the record - if you only check 2 columns like that, why don't you use pd.crosstab?
pd.crosstab(ratings_data.userID, ratings_data.subgameId, margins=True)
If you need pivot_table, then try to add argument fillna = 0
.
You can also try to do it on small subsample of the data - maybe the NaNs are properly introduced (many userID belonged to only small subset of subgameID)?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.