Я работаю со словарями и у меня возникла следующая ошибка
'>' not supported between instances of 'dict' and 'dict'
Я знаю, что есть некоторые проблемы со словарями в версиях Python 2.7 и 3.x.
print("number of nodes %d" % G.number_of_nodes())
print("number of edges %d" % G.number_of_edges())
print("Graph is connected?: %s" % nx.is_connected(G))
print("Number of connected components: %s" % nx.number_connected_components(G))
print("Size of connected componnents: %s" % [len(cc) for cc in nx.connected_components(G)])
print("Network Analysis will be performed on the largest cc from now on")
largest_cc = max(nx.connected_component_subgraphs(G), key=len)
dict_communities={}
num_communities=max([y for x,y in largest_cc.nodes(data=True)]).values()[0]
for i in range (1,num_communities+1):
dict_communities = [x for x,y in largest_cc.nodes(data=True) if y['community']==i]
TypeError Traceback (most recent call last)
in
1 dict_communities={}
----> 2 num_communities=max([y for x,y in largest_cc.nodes(data=True)])[0]
3 for i in range (1,num_communities+1):
4 dict_communities = [x for x,y in largest_cc.nodes(data=True) if y['community']==i]
TypeError: '>' not supported between instances of 'dict' and 'dict'
Подробнее здесь: https://stackoverflow.com/questions/564 ... t-and-dict
TypeError: '>' не поддерживается между экземплярами 'dict' и 'dict' ⇐ Python
Программы на Python
-
Anonymous
1732676645
Anonymous
Я работаю со словарями и у меня возникла следующая ошибка
'>' not supported between instances of 'dict' and 'dict'
Я знаю, что есть некоторые проблемы со словарями в версиях Python 2.7 и 3.x.
print("number of nodes %d" % G.number_of_nodes())
print("number of edges %d" % G.number_of_edges())
print("Graph is connected?: %s" % nx.is_connected(G))
print("Number of connected components: %s" % nx.number_connected_components(G))
print("Size of connected componnents: %s" % [len(cc) for cc in nx.connected_components(G)])
print("Network Analysis will be performed on the largest cc from now on")
largest_cc = max(nx.connected_component_subgraphs(G), key=len)
dict_communities={}
num_communities=max([y for x,y in largest_cc.nodes(data=True)]).values()[0]
for i in range (1,num_communities+1):
dict_communities[i] = [x for x,y in largest_cc.nodes(data=True) if y['community']==i]
TypeError Traceback (most recent call last)
in
1 dict_communities={}
----> 2 num_communities=max([y for x,y in largest_cc.nodes(data=True)])[0]
3 for i in range (1,num_communities+1):
4 dict_communities[i] = [x for x,y in largest_cc.nodes(data=True) if y['community']==i]
TypeError: '>' not supported between instances of 'dict' and 'dict'
Подробнее здесь: [url]https://stackoverflow.com/questions/56464957/typeerror-not-supported-between-instances-of-dict-and-dict[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия