{"action":"created","comment":{"url":"https://api.github.com/repos/numpy/numpy/pulls/comments/189404661","pull_request_review_id":121586543,"id":189404661,"diff_hunk":"@@ -3792,16 +4027,135 @@ def _quantile_ureduce_func(a, q, axis=None, out=None, overwrite_input=False,\n                 else:\n                     r = a.dtype.type(np.nan)\n             else:\n-                r[..., n.squeeze(0)] = a.dtype.type(np.nan)\n+                r[n.squeeze(axis)] = a.dtype.type(np.nan)\n         else:\n             if r.ndim == 1:\n                 r[:] = a.dtype.type(np.nan)\n             else:\n-                r[..., n.repeat(q.size, 0)] = a.dtype.type(np.nan)\n+                r[..., n.squeeze(axis)] = a.dtype.type(np.nan)\n \n     return r\n \n \n+def _indices_for_weighted_quantile(ap, q, axis, weights):\n+    \"\"\"\n+    Computes the indices of weighted quantiles along axis -1.\n+\n+    Parameters\n+    ----------\n+    ap : array_like\n+        Array where weighted quantiles are evaluated along axis.\n+    q : array_like\n+        Quantiles sought.\n+    axis : int\n+        Axis along which to evaluate quantiles.  Will be moved to -1 for\n+        np.vectorize operations.\n+    weights : array_like\n+        An array of weights associated with the values in `ap`.\n+\n+    Returns\n+    -------\n+    ap : array_like\n+        An expanded twice as large as the input `ap` array to perform\n+        interpolation on.  The axis of interest is moved to -1.\n+    indices : array_like\n+        Indices along the -1 axis of ap to interpolate.  All floats.\n+    Nx : scalar\n+        Length of the axis of ap.\n+    \"\"\"\n+    # first move to axis -1 for np.vectorize\n+    ap = np.swapaxes(ap.astype('f8'), axis, -1)\n+    weights = np.swapaxes(weights.astype('f8'), axis, -1)\n+\n+    # values with weight=0 are made nan and later sorted to end of array\n+    if ap[weights == 0.].any():","path":"numpy/lib/function_base.py","position":null,"original_position":505,"commit_id":"97b5f2ef543951fe94c94ab0dd9f4da06837d2b2","original_commit_id":"fca662cb6b4e8b96b57e94183db42684d36abc70","user":{"login":"chunweiyuan","id":5572303,"avatar_url":"https://avatars0.githubusercontent.com/u/5572303?v=4","gravatar_id":"","url":"https://api.github.com/users/chunweiyuan","html_url":"https://github.com/chunweiyuan","followers_url":"https://api.github.com/users/chunweiyuan/followers","following_url":"https://api.github.com/users/chunweiyuan/following{/other_user}","gists_url":"https://api.github.com/users/chunweiyuan/gists{/gist_id}","starred_url":"https://api.github.com/users/chunweiyuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chunweiyuan/subscriptions","organizations_url":"https://api.github.com/users/chunweiyuan/orgs","repos_url":"https://api.github.com/users/chunweiyuan/repos","events_url":"https://api.github.com/users/chunweiyuan/events{/privacy}","received_events_url":"https://api.github.com/users/chunweiyuan/received_events","type":"User","site_admin":false},"body":"Good catch.  The goal is just to find the places where weights==0, and set the corresponding cells in ap to nan.","created_at":"2018-05-18T22:14:58Z","updated_at":"2018-05-18T22:14:58Z","html_url":"https://github.com/numpy/numpy/pull/9211#discussion_r189404661","pull_request_url":"https://api.github.com/repos/numpy/numpy/pulls/9211","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments/189404661"},"html":{"href":"https://github.com/numpy/numpy/pull/9211#discussion_r189404661"},"pull_request":{"href":"https://api.github.com/repos/numpy/numpy/pulls/9211"}},"in_reply_to_id":189197116},"pull_request":{"url":"https://api.github.com/repos/numpy/numpy/pulls/9211","id":123805261,"html_url":"https://github.com/numpy/numpy/pull/9211","diff_url":"https://github.com/numpy/numpy/pull/9211.diff","patch_url":"https://github.com/numpy/numpy/pull/9211.patch","issue_url":"https://api.github.com/repos/numpy/numpy/issues/9211","number":9211,"state":"open","locked":false,"title":"ENH: Weighted quantile","user":{"login":"chunweiyuan","id":5572303,"avatar_url":"https://avatars0.githubusercontent.com/u/5572303?v=4","gravatar_id":"","url":"https://api.github.com/users/chunweiyuan","html_url":"https://github.com/chunweiyuan","followers_url":"https://api.github.com/users/chunweiyuan/followers","following_url":"https://api.github.com/users/chunweiyuan/following{/other_user}","gists_url":"https://api.github.com/users/chunweiyuan/gists{/gist_id}","starred_url":"https://api.github.com/users/chunweiyuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chunweiyuan/subscriptions","organizations_url":"https://api.github.com/users/chunweiyuan/orgs","repos_url":"https://api.github.com/users/chunweiyuan/repos","events_url":"https://api.github.com/users/chunweiyuan/events{/privacy}","received_events_url":"https://api.github.com/users/chunweiyuan/received_events","type":"User","site_admin":false},"body":"Creates `quantile()` function that allows `weights` input.","created_at":"2017-06-02T21:38:44Z","updated_at":"2018-05-18T22:14:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12b7860489d052e0067f498aeefb1e3664d6892e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":6359239,"url":"https://api.github.com/repos/numpy/numpy/labels/01%20-%20Enhancement","name":"01 - Enhancement","color":"fef2c0","default":false},{"id":16917082,"url":"https://api.github.com/repos/numpy/numpy/labels/component:%20numpy.lib","name":"component: numpy.lib","color":"009800","default":false}],"milestone":{"url":"https://api.github.com/repos/numpy/numpy/milestones/52","html_url":"https://github.com/numpy/numpy/milestone/52","labels_url":"https://api.github.com/repos/numpy/numpy/milestones/52/labels","id":2844628,"number":52,"title":"1.15.0 release","description":"","creator":{"login":"charris","id":77272,"avatar_url":"https://avatars3.githubusercontent.com/u/77272?v=4","gravatar_id":"","url":"https://api.github.com/users/charris","html_url":"https://github.com/charris","followers_url":"https://api.github.com/users/charris/followers","following_url":"https://api.github.com/users/charris/following{/other_user}","gists_url":"https://api.github.com/users/charris/gists{/gist_id}","starred_url":"https://api.github.com/users/charris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charris/subscriptions","organizations_url":"https://api.github.com/users/charris/orgs","repos_url":"https://api.github.com/users/charris/repos","events_url":"https://api.github.com/users/charris/events{/privacy}","received_events_url":"https://api.github.com/users/charris/received_events","type":"User","site_admin":false},"open_issues":26,"closed_issues":60,"state":"open","created_at":"2017-10-17T21:13:32Z","updated_at":"2018-05-18T20:12:26Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/numpy/numpy/pulls/9211/commits","review_comments_url":"https://api.github.com/repos/numpy/numpy/pulls/9211/comments","review_comment_url":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/9211/comments","statuses_url":"https://api.github.com/repos/numpy/numpy/statuses/97b5f2ef543951fe94c94ab0dd9f4da06837d2b2","head":{"label":"chunweiyuan:weighted_quantile","ref":"weighted_quantile","sha":"97b5f2ef543951fe94c94ab0dd9f4da06837d2b2","user":{"login":"chunweiyuan","id":5572303,"avatar_url":"https://avatars0.githubusercontent.com/u/5572303?v=4","gravatar_id":"","url":"https://api.github.com/users/chunweiyuan","html_url":"https://github.com/chunweiyuan","followers_url":"https://api.github.com/users/chunweiyuan/followers","following_url":"https://api.github.com/users/chunweiyuan/following{/other_user}","gists_url":"https://api.github.com/users/chunweiyuan/gists{/gist_id}","starred_url":"https://api.github.com/users/chunweiyuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chunweiyuan/subscriptions","organizations_url":"https://api.github.com/users/chunweiyuan/orgs","repos_url":"https://api.github.com/users/chunweiyuan/repos","events_url":"https://api.github.com/users/chunweiyuan/events{/privacy}","received_events_url":"https://api.github.com/users/chunweiyuan/received_events","type":"User","site_admin":false},"repo":{"id":88117937,"name":"numpy","full_name":"chunweiyuan/numpy","owner":{"login":"chunweiyuan","id":5572303,"avatar_url":"https://avatars0.githubusercontent.com/u/5572303?v=4","gravatar_id":"","url":"https://api.github.com/users/chunweiyuan","html_url":"https://github.com/chunweiyuan","followers_url":"https://api.github.com/users/chunweiyuan/followers","following_url":"https://api.github.com/users/chunweiyuan/following{/other_user}","gists_url":"https://api.github.com/users/chunweiyuan/gists{/gist_id}","starred_url":"https://api.github.com/users/chunweiyuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chunweiyuan/subscriptions","organizations_url":"https://api.github.com/users/chunweiyuan/orgs","repos_url":"https://api.github.com/users/chunweiyuan/repos","events_url":"https://api.github.com/users/chunweiyuan/events{/privacy}","received_events_url":"https://api.github.com/users/chunweiyuan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chunweiyuan/numpy","description":"Numpy main repository","fork":true,"url":"https://api.github.com/repos/chunweiyuan/numpy","forks_url":"https://api.github.com/repos/chunweiyuan/numpy/forks","keys_url":"https://api.github.com/repos/chunweiyuan/numpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chunweiyuan/numpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chunweiyuan/numpy/teams","hooks_url":"https://api.github.com/repos/chunweiyuan/numpy/hooks","issue_events_url":"https://api.github.com/repos/chunweiyuan/numpy/issues/events{/number}","events_url":"https://api.github.com/repos/chunweiyuan/numpy/events","assignees_url":"https://api.github.com/repos/chunweiyuan/numpy/assignees{/user}","branches_url":"https://api.github.com/repos/chunweiyuan/numpy/branches{/branch}","tags_url":"https://api.github.com/repos/chunweiyuan/numpy/tags","blobs_url":"https://api.github.com/repos/chunweiyuan/numpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chunweiyuan/numpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chunweiyuan/numpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/chunweiyuan/numpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chunweiyuan/numpy/statuses/{sha}","languages_url":"https://api.github.com/repos/chunweiyuan/numpy/languages","stargazers_url":"https://api.github.com/repos/chunweiyuan/numpy/stargazers","contributors_url":"https://api.github.com/repos/chunweiyuan/numpy/contributors","subscribers_url":"https://api.github.com/repos/chunweiyuan/numpy/subscribers","subscription_url":"https://api.github.com/repos/chunweiyuan/numpy/subscription","commits_url":"https://api.github.com/repos/chunweiyuan/numpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/chunweiyuan/numpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/chunweiyuan/numpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/chunweiyuan/numpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/chunweiyuan/numpy/contents/{+path}","compare_url":"https://api.github.com/repos/chunweiyuan/numpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chunweiyuan/numpy/merges","archive_url":"https://api.github.com/repos/chunweiyuan/numpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chunweiyuan/numpy/downloads","issues_url":"https://api.github.com/repos/chunweiyuan/numpy/issues{/number}","pulls_url":"https://api.github.com/repos/chunweiyuan/numpy/pulls{/number}","milestones_url":"https://api.github.com/repos/chunweiyuan/numpy/milestones{/number}","notifications_url":"https://api.github.com/repos/chunweiyuan/numpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chunweiyuan/numpy/labels{/name}","releases_url":"https://api.github.com/repos/chunweiyuan/numpy/releases{/id}","deployments_url":"https://api.github.com/repos/chunweiyuan/numpy/deployments","created_at":"2017-04-13T02:47:50Z","updated_at":"2017-04-13T02:47:56Z","pushed_at":"2018-05-18T22:14:25Z","git_url":"git://github.com/chunweiyuan/numpy.git","ssh_url":"git@github.com:chunweiyuan/numpy.git","clone_url":"https://github.com/chunweiyuan/numpy.git","svn_url":"https://github.com/chunweiyuan/numpy","homepage":"http://www.numpy.org/","size":55951,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"numpy:master","ref":"master","sha":"15f19c4058978ec30721d1295e093e4f53c5a6b9","user":{"login":"numpy","id":288276,"avatar_url":"https://avatars2.githubusercontent.com/u/288276?v=4","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://avatars2.githubusercontent.com/u/288276?v=4","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":"2018-05-18T20:13:08Z","pushed_at":"2018-05-18T22:14:31Z","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":57695,"stargazers_count":7245,"watchers_count":7245,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2768,"mirror_url":null,"archived":false,"open_issues_count":1900,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":2768,"open_issues":1900,"watchers":7245,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/9211"},"html":{"href":"https://github.com/numpy/numpy/pull/9211"},"issue":{"href":"https://api.github.com/repos/numpy/numpy/issues/9211"},"comments":{"href":"https://api.github.com/repos/numpy/numpy/issues/9211/comments"},"review_comments":{"href":"https://api.github.com/repos/numpy/numpy/pulls/9211/comments"},"review_comment":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/numpy/numpy/pulls/9211/commits"},"statuses":{"href":"https://api.github.com/repos/numpy/numpy/statuses/97b5f2ef543951fe94c94ab0dd9f4da06837d2b2"}},"author_association":"NONE"}}
{"actor":{"display_login":"chunweiyuan"}}