{"action":"created","comment":{"url":"https://api.github.com/repos/numpy/numpy/pulls/comments/61679544","id":61679544,"diff_hunk":"@@ -676,7 +678,10 @@ def _median(a, axis=None, out=None, overwrite_input=False):\n     if np.issubdtype(asorted.dtype, np.inexact):\n         # avoid inf / x = masked\n         s = np.ma.sum([low, high], axis=0, out=out)\n-        np.true_divide(s.data, 2., casting='unsafe', out=s.data)\n+        if hasattr(s,\"mask\"):","path":"numpy/ma/extras.py","position":30,"original_position":30,"commit_id":"51887f48d06a0d1101007866734c579f6eb3bf5e","original_commit_id":"51887f48d06a0d1101007866734c579f6eb3bf5e","user":{"login":"ahaldane","id":9040124,"avatar_url":"https://avatars.githubusercontent.com/u/9040124?v=3","gravatar_id":"","url":"https://api.github.com/users/ahaldane","html_url":"https://github.com/ahaldane","followers_url":"https://api.github.com/users/ahaldane/followers","following_url":"https://api.github.com/users/ahaldane/following{/other_user}","gists_url":"https://api.github.com/users/ahaldane/gists{/gist_id}","starred_url":"https://api.github.com/users/ahaldane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahaldane/subscriptions","organizations_url":"https://api.github.com/users/ahaldane/orgs","repos_url":"https://api.github.com/users/ahaldane/repos","events_url":"https://api.github.com/users/ahaldane/events{/privacy}","received_events_url":"https://api.github.com/users/ahaldane/received_events","type":"User","site_admin":false},"body":"isinstance here too","created_at":"2016-05-01T04:58:16Z","updated_at":"2016-05-01T04:58:16Z","html_url":"https://github.com/numpy/numpy/pull/7592#discussion_r61679544","pull_request_url":"https://api.github.com/repos/numpy/numpy/pulls/7592","_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments/61679544"},"html":{"href":"https://github.com/numpy/numpy/pull/7592#discussion_r61679544"},"pull_request":{"href":"https://api.github.com/repos/numpy/numpy/pulls/7592"}}},"pull_request":{"url":"https://api.github.com/repos/numpy/numpy/pulls/7592","id":68480141,"html_url":"https://github.com/numpy/numpy/pull/7592","diff_url":"https://github.com/numpy/numpy/pull/7592.diff","patch_url":"https://github.com/numpy/numpy/pull/7592.patch","issue_url":"https://api.github.com/repos/numpy/numpy/issues/7592","number":7592,"state":"open","locked":false,"title":"masked-array median of 1d array should return scalar","user":{"login":"AmitAronovitch","id":278328,"avatar_url":"https://avatars.githubusercontent.com/u/278328?v=3","gravatar_id":"","url":"https://api.github.com/users/AmitAronovitch","html_url":"https://github.com/AmitAronovitch","followers_url":"https://api.github.com/users/AmitAronovitch/followers","following_url":"https://api.github.com/users/AmitAronovitch/following{/other_user}","gists_url":"https://api.github.com/users/AmitAronovitch/gists{/gist_id}","starred_url":"https://api.github.com/users/AmitAronovitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmitAronovitch/subscriptions","organizations_url":"https://api.github.com/users/AmitAronovitch/orgs","repos_url":"https://api.github.com/users/AmitAronovitch/repos","events_url":"https://api.github.com/users/AmitAronovitch/events{/privacy}","received_events_url":"https://api.github.com/users/AmitAronovitch/received_events","type":"User","site_admin":false},"body":"It seems like PR #4760, which improved the n-dimensional performance of ma.median, has broken the behavior for the 1d case. The previous behavior seems more correct, because:\r\n\r\n(a) It matches the behavior of the non-masked median.\r\n(b) It matches the examples given in the doc-strings.\r\n(c) It matches a simpler rule: a median of n-dim array is n-1 dimensional.\r\n\r\nThis pull request fixes that, and adds a test that fails in the unfixed code. \r\n\r\nDetails:\r\nIt appears that the issue can be traced back to a special-case in numpy's \"advanced indexing\" algorithm, where a list of scalars is treated as a 1d array.\r\nThe fix works by avoiding this special case. The items of the index are forced to be arrays (in particular, scalars are converted to 0d arrays), so advanced indexing works in a consistent manner.\r\nI wrote it this way to explicitly highlight the fact that the 1d result should be consistent with higher dimensional cases. \r\nHowever, it is possible that an \"if dim==1\" would be more readable...\r\n\r\n","created_at":"2016-04-30T21:57:57Z","updated_at":"2016-05-01T04:58:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7c551b17a9f7c3965a5d4720bb3d1a73d7f77b38","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/numpy/numpy/pulls/7592/commits","review_comments_url":"https://api.github.com/repos/numpy/numpy/pulls/7592/comments","review_comment_url":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/7592/comments","statuses_url":"https://api.github.com/repos/numpy/numpy/statuses/51887f48d06a0d1101007866734c579f6eb3bf5e","head":{"label":"AmitAronovitch:master","ref":"master","sha":"51887f48d06a0d1101007866734c579f6eb3bf5e","user":{"login":"AmitAronovitch","id":278328,"avatar_url":"https://avatars.githubusercontent.com/u/278328?v=3","gravatar_id":"","url":"https://api.github.com/users/AmitAronovitch","html_url":"https://github.com/AmitAronovitch","followers_url":"https://api.github.com/users/AmitAronovitch/followers","following_url":"https://api.github.com/users/AmitAronovitch/following{/other_user}","gists_url":"https://api.github.com/users/AmitAronovitch/gists{/gist_id}","starred_url":"https://api.github.com/users/AmitAronovitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmitAronovitch/subscriptions","organizations_url":"https://api.github.com/users/AmitAronovitch/orgs","repos_url":"https://api.github.com/users/AmitAronovitch/repos","events_url":"https://api.github.com/users/AmitAronovitch/events{/privacy}","received_events_url":"https://api.github.com/users/AmitAronovitch/received_events","type":"User","site_admin":false},"repo":{"id":52825247,"name":"numpy","full_name":"AmitAronovitch/numpy","owner":{"login":"AmitAronovitch","id":278328,"avatar_url":"https://avatars.githubusercontent.com/u/278328?v=3","gravatar_id":"","url":"https://api.github.com/users/AmitAronovitch","html_url":"https://github.com/AmitAronovitch","followers_url":"https://api.github.com/users/AmitAronovitch/followers","following_url":"https://api.github.com/users/AmitAronovitch/following{/other_user}","gists_url":"https://api.github.com/users/AmitAronovitch/gists{/gist_id}","starred_url":"https://api.github.com/users/AmitAronovitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmitAronovitch/subscriptions","organizations_url":"https://api.github.com/users/AmitAronovitch/orgs","repos_url":"https://api.github.com/users/AmitAronovitch/repos","events_url":"https://api.github.com/users/AmitAronovitch/events{/privacy}","received_events_url":"https://api.github.com/users/AmitAronovitch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AmitAronovitch/numpy","description":"Numpy main repository","fork":true,"url":"https://api.github.com/repos/AmitAronovitch/numpy","forks_url":"https://api.github.com/repos/AmitAronovitch/numpy/forks","keys_url":"https://api.github.com/repos/AmitAronovitch/numpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AmitAronovitch/numpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AmitAronovitch/numpy/teams","hooks_url":"https://api.github.com/repos/AmitAronovitch/numpy/hooks","issue_events_url":"https://api.github.com/repos/AmitAronovitch/numpy/issues/events{/number}","events_url":"https://api.github.com/repos/AmitAronovitch/numpy/events","assignees_url":"https://api.github.com/repos/AmitAronovitch/numpy/assignees{/user}","branches_url":"https://api.github.com/repos/AmitAronovitch/numpy/branches{/branch}","tags_url":"https://api.github.com/repos/AmitAronovitch/numpy/tags","blobs_url":"https://api.github.com/repos/AmitAronovitch/numpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AmitAronovitch/numpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AmitAronovitch/numpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/AmitAronovitch/numpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AmitAronovitch/numpy/statuses/{sha}","languages_url":"https://api.github.com/repos/AmitAronovitch/numpy/languages","stargazers_url":"https://api.github.com/repos/AmitAronovitch/numpy/stargazers","contributors_url":"https://api.github.com/repos/AmitAronovitch/numpy/contributors","subscribers_url":"https://api.github.com/repos/AmitAronovitch/numpy/subscribers","subscription_url":"https://api.github.com/repos/AmitAronovitch/numpy/subscription","commits_url":"https://api.github.com/repos/AmitAronovitch/numpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/AmitAronovitch/numpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/AmitAronovitch/numpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/AmitAronovitch/numpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/AmitAronovitch/numpy/contents/{+path}","compare_url":"https://api.github.com/repos/AmitAronovitch/numpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AmitAronovitch/numpy/merges","archive_url":"https://api.github.com/repos/AmitAronovitch/numpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AmitAronovitch/numpy/downloads","issues_url":"https://api.github.com/repos/AmitAronovitch/numpy/issues{/number}","pulls_url":"https://api.github.com/repos/AmitAronovitch/numpy/pulls{/number}","milestones_url":"https://api.github.com/repos/AmitAronovitch/numpy/milestones{/number}","notifications_url":"https://api.github.com/repos/AmitAronovitch/numpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AmitAronovitch/numpy/labels{/name}","releases_url":"https://api.github.com/repos/AmitAronovitch/numpy/releases{/id}","deployments_url":"https://api.github.com/repos/AmitAronovitch/numpy/deployments","created_at":"2016-02-29T21:14:55Z","updated_at":"2016-02-29T21:15:00Z","pushed_at":"2016-04-30T21:25:22Z","git_url":"git://github.com/AmitAronovitch/numpy.git","ssh_url":"git@github.com:AmitAronovitch/numpy.git","clone_url":"https://github.com/AmitAronovitch/numpy.git","svn_url":"https://github.com/AmitAronovitch/numpy","homepage":"http://www.numpy.org/","size":45137,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"numpy:master","ref":"master","sha":"fffe1fb03561b361c736e5f6771dc8a0721eb440","user":{"login":"numpy","id":288276,"avatar_url":"https://avatars.githubusercontent.com/u/288276?v=3","gravatar_id":"","url":"https://api.github.com/users/numpy","html_url":"https://github.com/numpy","followers_url":"https://api.github.com/users/numpy/followers","following_url":"https://api.github.com/users/numpy/following{/other_user}","gists_url":"https://api.github.com/users/numpy/gists{/gist_id}","starred_url":"https://api.github.com/users/numpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numpy/subscriptions","organizations_url":"https://api.github.com/users/numpy/orgs","repos_url":"https://api.github.com/users/numpy/repos","events_url":"https://api.github.com/users/numpy/events{/privacy}","received_events_url":"https://api.github.com/users/numpy/received_events","type":"Organization","site_admin":false},"repo":{"id":908607,"name":"numpy","full_name":"numpy/numpy","owner":{"login":"numpy","id":288276,"avatar_url":"https://avatars.githubusercontent.com/u/288276?v=3","gravatar_id":"","url":"https://api.github.com/users/numpy","html_url":"https://github.com/numpy","followers_url":"https://api.github.com/users/numpy/followers","following_url":"https://api.github.com/users/numpy/following{/other_user}","gists_url":"https://api.github.com/users/numpy/gists{/gist_id}","starred_url":"https://api.github.com/users/numpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numpy/subscriptions","organizations_url":"https://api.github.com/users/numpy/orgs","repos_url":"https://api.github.com/users/numpy/repos","events_url":"https://api.github.com/users/numpy/events{/privacy}","received_events_url":"https://api.github.com/users/numpy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/numpy/numpy","description":"Numpy main repository","fork":false,"url":"https://api.github.com/repos/numpy/numpy","forks_url":"https://api.github.com/repos/numpy/numpy/forks","keys_url":"https://api.github.com/repos/numpy/numpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/numpy/numpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/numpy/numpy/teams","hooks_url":"https://api.github.com/repos/numpy/numpy/hooks","issue_events_url":"https://api.github.com/repos/numpy/numpy/issues/events{/number}","events_url":"https://api.github.com/repos/numpy/numpy/events","assignees_url":"https://api.github.com/repos/numpy/numpy/assignees{/user}","branches_url":"https://api.github.com/repos/numpy/numpy/branches{/branch}","tags_url":"https://api.github.com/repos/numpy/numpy/tags","blobs_url":"https://api.github.com/repos/numpy/numpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/numpy/numpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/numpy/numpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/numpy/numpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/numpy/numpy/statuses/{sha}","languages_url":"https://api.github.com/repos/numpy/numpy/languages","stargazers_url":"https://api.github.com/repos/numpy/numpy/stargazers","contributors_url":"https://api.github.com/repos/numpy/numpy/contributors","subscribers_url":"https://api.github.com/repos/numpy/numpy/subscribers","subscription_url":"https://api.github.com/repos/numpy/numpy/subscription","commits_url":"https://api.github.com/repos/numpy/numpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/numpy/numpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/numpy/numpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/numpy/numpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/numpy/numpy/contents/{+path}","compare_url":"https://api.github.com/repos/numpy/numpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/numpy/numpy/merges","archive_url":"https://api.github.com/repos/numpy/numpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/numpy/numpy/downloads","issues_url":"https://api.github.com/repos/numpy/numpy/issues{/number}","pulls_url":"https://api.github.com/repos/numpy/numpy/pulls{/number}","milestones_url":"https://api.github.com/repos/numpy/numpy/milestones{/number}","notifications_url":"https://api.github.com/repos/numpy/numpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/numpy/numpy/labels{/name}","releases_url":"https://api.github.com/repos/numpy/numpy/releases{/id}","deployments_url":"https://api.github.com/repos/numpy/numpy/deployments","created_at":"2010-09-13T23:02:39Z","updated_at":"2016-04-30T21:34:06Z","pushed_at":"2016-05-01T02:58:48Z","git_url":"git://github.com/numpy/numpy.git","ssh_url":"git@github.com:numpy/numpy.git","clone_url":"https://github.com/numpy/numpy.git","svn_url":"https://github.com/numpy/numpy","homepage":"http://www.numpy.org/","size":81931,"stargazers_count":2891,"watchers_count":2891,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1502,"mirror_url":null,"open_issues_count":1205,"forks":1502,"open_issues":1205,"watchers":2891,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/7592"},"html":{"href":"https://github.com/numpy/numpy/pull/7592"},"issue":{"href":"https://api.github.com/repos/numpy/numpy/issues/7592"},"comments":{"href":"https://api.github.com/repos/numpy/numpy/issues/7592/comments"},"review_comments":{"href":"https://api.github.com/repos/numpy/numpy/pulls/7592/comments"},"review_comment":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/numpy/numpy/pulls/7592/commits"},"statuses":{"href":"https://api.github.com/repos/numpy/numpy/statuses/51887f48d06a0d1101007866734c579f6eb3bf5e"}}}}