用 Python 构建推荐引擎
Rob O'Callaghan
Director of Data


| 项目 | 属性 1 | 属性 2 | 属性 3 | 属性 4 |
|---|---|---|---|---|
| Item_001 | 0 | 1 | 1 | 0 |
| Item_002 | 1 | 0 | 1 | 0 |
| Item_003 | 0 | 1 | 0 | 1 |
| 书籍 | 体裁 |
|---|---|
| The Hobbit | Adventure |
| The Hobbit | Fantasy |
| The Great Gatsby | Tragedy |
| ... | ... |
| 书籍 | 冒险 | 奇幻 | 悲剧 | ... |
|---|---|---|---|---|
| The Hobbit | 1 | 1 | 0 | ... |
| The Great Gatsby | 0 | 0 | 1 | ... |
| ... | ... | ... | ... | ... |
pd.crosstab( , )
pd.crosstab(book_genre_df['Book'], book_genre_df['Genre'])
| 书籍 | 冒险 | 奇幻 | 悲剧 | 社会评论 |
|---|---|---|---|---|
| The Hobbit | 1 | 1 | 0 | 0 |
| The Great Gatsby | 0 | 0 | 1 | 1 |
| A Game of Thrones | 0 | 1 | 0 | 0 |
| Macbeth | 0 | 0 | 1 | 0 |
| ... | ... | ... | ... | ... |
用 Python 构建推荐引擎