Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 81ec9fc

Browse files
authoredFeb 15, 2024
Update gnn_citations.py (#1761)
* Update gnn_citations.py Fixing a simple issue Traceback (most recent call last): File "/Users/xxxxxx/Desktop/keras-io/examples/graph/gnn_citations.py", line 251, in <module> x_train = train_data[feature_names].to_numpy() ~~~~~~~~~~^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/pandas/core/frame.py", line 3857, in __getitem__ check_dict_or_set_indexers(key) File "/opt/homebrew/lib/python3.11/site-packages/pandas/core/indexing.py", line 2687, in check_dict_or_set_indexers raise TypeError( TypeError: Passing a set as an indexer is not supported. Use a list instead. Convert to list * Update gnn_citations.ipynb Also update set to list in ipynb file * Update gnn_citations.md Also update .md file
1 parent 222fbd8 commit 81ec9fc

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
 

‎examples/graph/gnn_citations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def create_ffn(hidden_units, dropout_rate, name=None):
242242
### Prepare the data for the baseline model
243243
"""
244244

245-
feature_names = set(papers.columns) - {"paper_id", "subject"}
245+
feature_names = list(set(papers.columns) - {"paper_id", "subject"})
246246
num_features = len(feature_names)
247247
num_classes = len(class_idx)
248248

‎examples/graph/ipynb/gnn_citations.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@
461461
},
462462
"outputs": [],
463463
"source": [
464-
"feature_names = set(papers.columns) - {\"paper_id\", \"subject\"}\n",
464+
"feature_names = list(set(papers.columns) - {\"paper_id\", \"subject\"})\n",
465465
"num_features = len(feature_names)\n",
466466
"num_classes = len(class_idx)\n",
467467
"\n",

‎examples/graph/md/gnn_citations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def create_ffn(hidden_units, dropout_rate, name=None):
400400

401401

402402
```python
403-
feature_names = set(papers.columns) - {"paper_id", "subject"}
403+
feature_names = list(set(papers.columns) - {"paper_id", "subject"})
404404
num_features = len(feature_names)
405405
num_classes = len(class_idx)
406406

0 commit comments

Comments
 (0)