You are using version 2.0 of networkx. Which changed from using a dict
for G.degree()
to using a dict-like (but not dict) DegreeView
. See this guide.
To have the degrees in a list you can use a list-comprehension:
degrees = [val for (node, val) in G.degree()]
Related Posts:
- I get a syntax error and an error saying illegal target for variable annotation. How do I fix it?
- No module named pandas_datareader
- ‘dict’ object has no attribute ‘has_key’
- Series Summation using for loop in python
- Python 3: UnboundLocalError: local variable referenced before assignment
- Why Am I Getting ELIF Invalid Syntax Error?
- Alternative to scipy.misc.imresize()
- Get degree of each nodes in a graph by Networkx in python
- Dlib installation error?
- Virtualenv – workon command not found
- How do I create a popup window in tkinter?
- ‘python3’ is not recognized as an internal or external command, operable program or batch file
- How do I remove/delete a virtualenv?
- pandas equivalent of R’s cbind (concatenate/stack vectors vertically)
- Import py file in another directory in Jupyter notebook
- Why would cv2.COLOR_RGB2GRAY and cv2.COLOR_BGR2GRAY give different results?
- Pip install on Mac OS gets error: command ‘/usr/bin/clang’ failed with exit code 1
- unsupported format string passed to numpy.ndarray
- How to open a file using the open with statement
- How can I represent an ‘Enum’ in Python?
- Relative imports – ModuleNotFoundError: No module named x
- Relative imports – ModuleNotFoundError: No module named x
- How do I upgrade the Python installation in Windows 10?
- Python Variable Declaration
- Best way to convert string to bytes in Python 3?
- PermissionError: [Errno 13] Permission denied
- What is setup.py?
- Relative imports in Python 3
- How to remove EOFError: EOF when reading a line?
- TypeError: cannot unpack non-iterable NoneType object
- Is there a ‘foreach’ function in Python 3?
- Python inline if statement
- How to copy a dictionary and only edit the copy
- How to print like printf in Python3?
- Could not find a version that satisfies the requirement tensorflow
- What are type hints in Python 3.5?
- TypeError: ‘type’ object is not subscriptable when indexing in to a dictionary
- Invalid character in identifier
- ‘str’ object has no attribute ‘decode’. Python 3 error?
- How to find all the indexes of a recurring item in a list?
- pandas: merge (join) two data frames on multiple columns
- Unable to initialize device PRN in Python
- How do you use subprocess.check_output() in Python?
- (Help) TypeError: ‘str’ object cannot be interpreted as an integer
- Why KeyError: 0
- Are dictionaries ordered in Python 3.6+?
- SSH using python script
- builtins.TypeError: must be str, not bytes
- TypeError: write() argument must be str, not bytes (Python 3 vs Python 2 )
- Python error message io.UnsupportedOperation: not readable
- takes 1 positional argument but 2 were given
- Python 3 ImportError: No module named ‘ConfigParser’
- Why am I getting this syntax error: keyword can’t be an expression
- re.search().TypeError: cannot use a string pattern on a bytes-like object
- Add Legend to Seaborn point plot
- ctypes – Beginner
- How can I install Python’s pip3 on my Mac?
- Get ZeroDivisionError: float division in python
- TypeError: ‘encoding’ is an invalid keyword argument for this function
- What is the Python 3 equivalent of “python -m SimpleHTTPServer”
- What does -> mean in Python function definitions?
- TypeError(“‘bool’ object is not iterable”,) when trying to return a Boolean
- “The path python3 (from –python=python3) does not exist” error
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- Convert bytes to int?
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- How to troubleshoot an “AttributeError: __exit__” in multiproccesing in Python?
- TypeError; Must use key word argument or key function in python 3.x
- How to install requests module in Python 3.4, instead of 2.7
- Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings
- AttributeError: ‘module’ object has no attribute ‘urlretrieve’
- Python map object is not subscriptable
- .pyw files in python program
- Replacing a character from a certain index
- ImportError: No module named ‘google’
- Ruby equivalent for Python’s “try”?
- Get a random sample with replacement
- NameError: global name ‘unicode’ is not defined – in Python 3
- Conda command is not recognized on Windows 10
- TypeError: int() argument must be a string, a bytes-like object or a number, not ‘list’
- Python TypeError: non-empty format string passed to object.__format__
- AttributeError: ‘Series’ object has no attribute ‘reshape’
- ImportError: No module named ‘django.core.urlresolvers’
- How to do a Sigma in python 3
- Python 3: Multiply a vector by a matrix without NumPy
- How to fix “Can’t find a default Python” error
- TypeError: ‘newline’ is an invalid keyword argument for this function
- environment variables PYSPARK_PYTHON and PYSPARK_DRIVER_PYTHON
- Python: urllib.error.HTTPError: HTTP Error 404: Not Found
- How to embed image or picture in jupyter notebook, either from a local machine or from a web resource?
- How to create Gephi network graphs from Python?
- What is the correct format to write float value to file in Python
- “E: Unable to locate package python3-pip”
- How to draw a line with matplotlib?
- How to print a specific row of a pandas DataFrame?
- Accessing dict_keys element by index in Python3
- Why can’t I print to terminal with my python script?
- How to install Anaconda on RaspBerry Pi 3 Model B
- KeyError: ‘plotly_domain’
- TypeError: ‘zip’ object is not subscriptable