回答編集履歴

2

Update

2022/05/15 05:28

投稿

melian
melian

スコア19840

test CHANGED
@@ -1,9 +1,11 @@
1
1
  ```python
2
2
  dfx = (
3
- df.groupby(df[['source', 'target']].apply(
3
+ df.groupby(df[['source', 'target']].apply(frozenset, axis=1),
4
- lambda x: frozenset(x), axis=1), sort=False, as_index=False)
4
+ sort=False, as_index=False)
5
5
  .first())
6
+
6
7
  print(dfx)
8
+
7
9
 
8
10
  #
9
11
  id name source target

1

Update

2022/05/15 05:25

投稿

melian
melian

スコア19840

test CHANGED
@@ -1,7 +1,7 @@
1
1
  ```python
2
2
  dfx = (
3
3
  df.groupby(df[['source', 'target']].apply(
4
- lambda x: tuple(set(x)), axis=1), as_index=False)
4
+ lambda x: frozenset(x), axis=1), sort=False, as_index=False)
5
5
  .first())
6
6
  print(dfx)
7
7