df.query( 'timestamp>="2021-10-07"' ).copy() # 過去に読んだ記事の一覧を取得 train_df.groupby( 'user_id')['article_id'].apply(list) """ user_id 7 [13014, 32015, 32729, 11244, 19295, 7788, 3539... 44 [36725, 29705, 13765, 28933, 12981, 10959, 102... ... 1272015 [13014, 30452, 2454, 19381, 12100] 1272043 [11244, 24171] Name: article_id, Length: 56958, dtype: object """ 記事推薦の準備 22