回答編集履歴
1
テキスト修正
answer
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
もっと簡単なやり方があるかもしれませんが、愚直にやると、こんな感じになるかなと思います。(以下のコードで `df` は、元のCSVから作成したDataFrameとします。)
|
3
3
|
|
4
4
|
```python3
|
5
|
-
|
5
|
+
cities = sorted(set(df["city1"].values) | set(df["city2"].values))
|
6
|
-
cities = sorted([*cities_set])
|
7
6
|
|
8
7
|
adjacency_matrix = pd.DataFrame(index=cities, columns=cities, data=0)
|
9
8
|
|