how can i fix AttributeError: 'dict_values' object has no attribute 'count'?
networkx, python, python-3.x
Solution
In Python3 `dict.values()` returns "views" instead of lists:
- dict methods dict.keys(), dict.items() and dict.values() return "views" instead of lists. https://docs.python.org/3/whatsnew/3.0.html
To convert the "view" into a list, simply wrap `in_degrees.values()` in a `list()`:
in_hist = [list(in_degrees.values()).count(x) for x in in_values]
Problem
here is my code and the text file is here ``` import networkx as nx import pylab as plt webg = nx.read_edgelist('web-graph.txt',create_using=nx.DiGraph(),nodetype=int) in_degrees = webg.in_degree() in_values = sorted(set(in_degrees.values())) in_hist = [in_degrees.values().count(x)for x in in_values] ``` I want to plot degree distribution web graph how can i change dict to solve?