【发布时间】:2022-01-16 18:40:39
【问题描述】:
66 test_indexes = set(random.sample(indexes, len(indexes)//2)) # removing 50% edges from test data
67 train_indexes = set(indexes).difference(test_indexes)
---> 68 test_list = [edge_list[i] for i in test_indexes]
69 train_list = [edge_list[i] for i in train_indexes]
70 return train_list,test_list
TypeError: 'map' 对象不可下标
我想知道如何将 edgelist(这是一个地图)的一部分放入 test_list>请帮我解决这个问题
【问题讨论】:
-
请发布完整的可运行代码,包括示例输入
标签: python python-3.x python-2.7 dictionary