回答編集履歴
1
Update
test
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
```python
|
2
|
-
dfx = pd.concat([df1, df2])
|
3
|
-
dfx = d
|
2
|
+
dfx = pd.concat([df1, df2]).query('contents_id in @df2["contents_id"]').sort_values('contents_id')
|
4
3
|
print(dfx.to_markdown(index=False))
|
5
4
|
```
|
6
5
|
|
7
|
-
| user_id | contents_id |
|
6
|
+
| user_id | contents_id | rating |
|
8
|
-
|----------:|--------------:|---------
|
7
|
+
|----------:|--------------:|:---------|
|
9
|
-
| 1 | 11 |
|
8
|
+
| 1 | 11 | 3 |
|
10
|
-
| 3 | 11 |
|
9
|
+
| 3 | 11 | 4 |
|
11
|
-
| 5 | 11 |
|
10
|
+
| 5 | 11 | |
|
12
|
-
| 2 | 12 |
|
11
|
+
| 2 | 12 | 3 |
|
13
|
-
| 5 | 12 |
|
12
|
+
| 5 | 12 | |
|
14
|
-
| 3 | 13 |
|
13
|
+
| 3 | 13 | 4 |
|
15
|
-
| 5 | 13 |
|
14
|
+
| 5 | 13 | |
|
16
15
|
|