{"action":"created","issue":{"url":"https://api.github.com/repos/networkx/networkx/issues/1884","labels_url":"https://api.github.com/repos/networkx/networkx/issues/1884/labels{/name}","comments_url":"https://api.github.com/repos/networkx/networkx/issues/1884/comments","events_url":"https://api.github.com/repos/networkx/networkx/issues/1884/events","html_url":"https://github.com/networkx/networkx/pull/1884","id":124065458,"number":1884,"title":"add option to view specific attributes in G.nodes()","user":{"login":"MridulS","id":5363860,"avatar_url":"https://avatars.githubusercontent.com/u/5363860?v=3","gravatar_id":"","url":"https://api.github.com/users/MridulS","html_url":"https://github.com/MridulS","followers_url":"https://api.github.com/users/MridulS/followers","following_url":"https://api.github.com/users/MridulS/following{/other_user}","gists_url":"https://api.github.com/users/MridulS/gists{/gist_id}","starred_url":"https://api.github.com/users/MridulS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MridulS/subscriptions","organizations_url":"https://api.github.com/users/MridulS/orgs","repos_url":"https://api.github.com/users/MridulS/repos","events_url":"https://api.github.com/users/MridulS/events{/privacy}","received_events_url":"https://api.github.com/users/MridulS/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-28T13:07:29Z","updated_at":"2016-01-09T02:28:38Z","closed_at":"2015-12-29T12:52:43Z","pull_request":{"url":"https://api.github.com/repos/networkx/networkx/pulls/1884","html_url":"https://github.com/networkx/networkx/pull/1884","diff_url":"https://github.com/networkx/networkx/pull/1884.diff","patch_url":"https://github.com/networkx/networkx/pull/1884.patch"},"body":"This is now consistent with the behaviour of the data parameter of `G.edges()`. We can interact in the same way and get an iterator over (nodes, value of attribute) by `G.nodes(data='attribute')`.\r\n\r\n``` python\r\n>>> G = nx.Graph()\r\n>>> G.add_nodes_from([0, 1 ,2])\r\n>>> G.add_node(1, time='5pm')\r\n>>> G.node[0]['foo'] = 'bar'\r\n>>> list(G.nodes(data=True))\r\n[(0, {'foo': 'bar'}), (1, {'time': '5pm'}), (2, {})]\r\n>>> list(G.nodes(data='foo'))\r\n[(0, 'bar'), (1, None), (2, None)]\r\n>>> list(G.nodes(data='time'))\r\n[(0, None), (1, '5pm'), (2, None)]\r\n >>> list(G.nodes(data='time', default='Not Available'))\r\n[(0, 'Not Available'), (1, '5pm'), (2, 'Not Available')]\r\n```"},"comment":{"url":"https://api.github.com/repos/networkx/networkx/issues/comments/170182417","html_url":"https://github.com/networkx/networkx/pull/1884#issuecomment-170182417","issue_url":"https://api.github.com/repos/networkx/networkx/issues/1884","id":170182417,"user":{"login":"dschult","id":915037,"avatar_url":"https://avatars.githubusercontent.com/u/915037?v=3","gravatar_id":"","url":"https://api.github.com/users/dschult","html_url":"https://github.com/dschult","followers_url":"https://api.github.com/users/dschult/followers","following_url":"https://api.github.com/users/dschult/following{/other_user}","gists_url":"https://api.github.com/users/dschult/gists{/gist_id}","starred_url":"https://api.github.com/users/dschult/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dschult/subscriptions","organizations_url":"https://api.github.com/users/dschult/orgs","repos_url":"https://api.github.com/users/dschult/repos","events_url":"https://api.github.com/users/dschult/events{/privacy}","received_events_url":"https://api.github.com/users/dschult/received_events","type":"User","site_admin":false},"created_at":"2016-01-09T02:28:38Z","updated_at":"2016-01-09T02:28:38Z","body":"It wasn't working in the docs before... perhaps because the blank line was not there.\r\nThe code was formatted as a single paragraph.\r\nIn any case a single colon and blank line puts the examples in a [nice box in sphinx](http://networkx.readthedocs.org/en/latest/reference/generated/networkx.Graph.nodes.html).\r\n\r\nI thought we were all over to sphinx for docs.  Is numpydoc used somewhere?"}}