{"action":"created","comment":{"url":"https://api.github.com/repos/scipy/scipy/pulls/comments/51939326","id":51939326,"diff_hunk":"@@ -2306,6 +2311,186 @@ def zmap(scores, compare, axis=0, ddof=0):\n         return (scores - mns) / sstd\n \n \n+def _iqr_scale_to_num(scale):\n+    \"\"\"\n+    A helper function to convert the 'scale' argument of `iqr` to a number.\n+\n+    scale: str\n+        If scale is one of ['raw', 'normal'], this function will map the string\n+        to a value.\n+\n+    The concept for this function is borrowed heavily from the `numpy.histogram`\n+    helper function `_hist_optim_numbins_estimator`.\n+    \"\"\"\n+    assert isinstance(scale, string_types)\n+    # private function should not be called otherwise\n+\n+    # See https://en.wikipedia.org/wiki/Robust_measures_of_scale\n+    scale_conversions = {'raw': 1.0,\n+                         'normal': special.erfinv(0.5) * 2.0 * math.sqrt(2.0)}\n+    try:\n+        return scale_conversions[scale.lower()]\n+    except KeyError:\n+        raise ValueError(\"{0} not a valid scale for `iqr`\".format(scale))\n+\n+\n+def iqr(x, axis=None, range=(25, 75), scale='raw', nan_policy='propagate',","path":"scipy/stats/stats.py","position":75,"original_position":75,"commit_id":"7285db0dbd4859bc0fe46eb480221760ac348514","original_commit_id":"7285db0dbd4859bc0fe46eb480221760ac348514","user":{"login":"rgommers","id":98330,"avatar_url":"https://avatars.githubusercontent.com/u/98330?v=3","gravatar_id":"","url":"https://api.github.com/users/rgommers","html_url":"https://github.com/rgommers","followers_url":"https://api.github.com/users/rgommers/followers","following_url":"https://api.github.com/users/rgommers/following{/other_user}","gists_url":"https://api.github.com/users/rgommers/gists{/gist_id}","starred_url":"https://api.github.com/users/rgommers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgommers/subscriptions","organizations_url":"https://api.github.com/users/rgommers/orgs","repos_url":"https://api.github.com/users/rgommers/repos","events_url":"https://api.github.com/users/rgommers/events{/privacy}","received_events_url":"https://api.github.com/users/rgommers/received_events","type":"User","site_admin":false},"body":"``range`` is a builtin, so can you rename this keyword?","created_at":"2016-02-04T21:22:13Z","updated_at":"2016-02-04T21:22:13Z","html_url":"https://github.com/scipy/scipy/pull/5808#discussion_r51939326","pull_request_url":"https://api.github.com/repos/scipy/scipy/pulls/5808","_links":{"self":{"href":"https://api.github.com/repos/scipy/scipy/pulls/comments/51939326"},"html":{"href":"https://github.com/scipy/scipy/pull/5808#discussion_r51939326"},"pull_request":{"href":"https://api.github.com/repos/scipy/scipy/pulls/5808"}}},"pull_request":{"url":"https://api.github.com/repos/scipy/scipy/pulls/5808","id":58348049,"html_url":"https://github.com/scipy/scipy/pull/5808","diff_url":"https://github.com/scipy/scipy/pull/5808.diff","patch_url":"https://github.com/scipy/scipy/pull/5808.patch","issue_url":"https://api.github.com/repos/scipy/scipy/issues/5808","number":5808,"state":"open","locked":false,"title":"ENH: Added iqr function to compute IQR metric in scipy/stats/stats.py","user":{"login":"madphysicist","id":4617010,"avatar_url":"https://avatars.githubusercontent.com/u/4617010?v=3","gravatar_id":"","url":"https://api.github.com/users/madphysicist","html_url":"https://github.com/madphysicist","followers_url":"https://api.github.com/users/madphysicist/followers","following_url":"https://api.github.com/users/madphysicist/following{/other_user}","gists_url":"https://api.github.com/users/madphysicist/gists{/gist_id}","starred_url":"https://api.github.com/users/madphysicist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madphysicist/subscriptions","organizations_url":"https://api.github.com/users/madphysicist/orgs","repos_url":"https://api.github.com/users/madphysicist/repos","events_url":"https://api.github.com/users/madphysicist/events{/privacy}","received_events_url":"https://api.github.com/users/madphysicist/received_events","type":"User","site_admin":false},"body":"Transfer of numpy PR https://github.com/numpy/numpy/pull/7137.\r\n\r\nThis function is different from the IQR in statsmodels. It appears to have different inputs (one array versus two), which actually makes this version more general.\r\n\r\nAs per @rgommers's [request][1], I have added `nan_policy`, which basically just selects between `np.percentile` and `np.nanpercentile`. Since there were some bugs in the shape of arrays returned by `np.nanpercentile`, I have added a workaround that should eventually be removed.\r\n\r\nAs per @josef-pkt's [request][2], I have added a 'scale' argument that accepts the values `'raw'` or `1.0`, `'normal'` or `sp.special.erfinv(0.5) * 2 * sp.sqrt(2) ~= 1.349`, or any other number. The result is divided by the scale. The default is `'raw'`.\r\n\r\n  [1]: https://github.com/numpy/numpy/pull/7137#issuecomment-176633198\r\n  [2]: https://github.com/numpy/numpy/pull/7137#issuecomment-176522779\r\n\r\nThe tests have been transferred almost as-is from numpy. However, if the numpy version being used is < 1.11.0, tests involving `interpolation='midpoint'` are turned off because bug-fix https://github.com/numpy/numpy/pull/7129 and its backport https://github.com/numpy/numpy/pull/7166 would not be in effect.","created_at":"2016-02-04T20:59:46Z","updated_at":"2016-02-04T21:22:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1750abe2630c8117ace93fcd479ac4a59bd7fdac","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scipy/scipy/pulls/5808/commits","review_comments_url":"https://api.github.com/repos/scipy/scipy/pulls/5808/comments","review_comment_url":"https://api.github.com/repos/scipy/scipy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scipy/scipy/issues/5808/comments","statuses_url":"https://api.github.com/repos/scipy/scipy/statuses/7285db0dbd4859bc0fe46eb480221760ac348514","head":{"label":"madphysicist:iqr-function","ref":"iqr-function","sha":"7285db0dbd4859bc0fe46eb480221760ac348514","user":{"login":"madphysicist","id":4617010,"avatar_url":"https://avatars.githubusercontent.com/u/4617010?v=3","gravatar_id":"","url":"https://api.github.com/users/madphysicist","html_url":"https://github.com/madphysicist","followers_url":"https://api.github.com/users/madphysicist/followers","following_url":"https://api.github.com/users/madphysicist/following{/other_user}","gists_url":"https://api.github.com/users/madphysicist/gists{/gist_id}","starred_url":"https://api.github.com/users/madphysicist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madphysicist/subscriptions","organizations_url":"https://api.github.com/users/madphysicist/orgs","repos_url":"https://api.github.com/users/madphysicist/repos","events_url":"https://api.github.com/users/madphysicist/events{/privacy}","received_events_url":"https://api.github.com/users/madphysicist/received_events","type":"User","site_admin":false},"repo":{"id":48251470,"name":"scipy","full_name":"madphysicist/scipy","owner":{"login":"madphysicist","id":4617010,"avatar_url":"https://avatars.githubusercontent.com/u/4617010?v=3","gravatar_id":"","url":"https://api.github.com/users/madphysicist","html_url":"https://github.com/madphysicist","followers_url":"https://api.github.com/users/madphysicist/followers","following_url":"https://api.github.com/users/madphysicist/following{/other_user}","gists_url":"https://api.github.com/users/madphysicist/gists{/gist_id}","starred_url":"https://api.github.com/users/madphysicist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madphysicist/subscriptions","organizations_url":"https://api.github.com/users/madphysicist/orgs","repos_url":"https://api.github.com/users/madphysicist/repos","events_url":"https://api.github.com/users/madphysicist/events{/privacy}","received_events_url":"https://api.github.com/users/madphysicist/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/madphysicist/scipy","description":"Scipy library main repository","fork":true,"url":"https://api.github.com/repos/madphysicist/scipy","forks_url":"https://api.github.com/repos/madphysicist/scipy/forks","keys_url":"https://api.github.com/repos/madphysicist/scipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/madphysicist/scipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/madphysicist/scipy/teams","hooks_url":"https://api.github.com/repos/madphysicist/scipy/hooks","issue_events_url":"https://api.github.com/repos/madphysicist/scipy/issues/events{/number}","events_url":"https://api.github.com/repos/madphysicist/scipy/events","assignees_url":"https://api.github.com/repos/madphysicist/scipy/assignees{/user}","branches_url":"https://api.github.com/repos/madphysicist/scipy/branches{/branch}","tags_url":"https://api.github.com/repos/madphysicist/scipy/tags","blobs_url":"https://api.github.com/repos/madphysicist/scipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/madphysicist/scipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/madphysicist/scipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/madphysicist/scipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/madphysicist/scipy/statuses/{sha}","languages_url":"https://api.github.com/repos/madphysicist/scipy/languages","stargazers_url":"https://api.github.com/repos/madphysicist/scipy/stargazers","contributors_url":"https://api.github.com/repos/madphysicist/scipy/contributors","subscribers_url":"https://api.github.com/repos/madphysicist/scipy/subscribers","subscription_url":"https://api.github.com/repos/madphysicist/scipy/subscription","commits_url":"https://api.github.com/repos/madphysicist/scipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/madphysicist/scipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/madphysicist/scipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/madphysicist/scipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/madphysicist/scipy/contents/{+path}","compare_url":"https://api.github.com/repos/madphysicist/scipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/madphysicist/scipy/merges","archive_url":"https://api.github.com/repos/madphysicist/scipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/madphysicist/scipy/downloads","issues_url":"https://api.github.com/repos/madphysicist/scipy/issues{/number}","pulls_url":"https://api.github.com/repos/madphysicist/scipy/pulls{/number}","milestones_url":"https://api.github.com/repos/madphysicist/scipy/milestones{/number}","notifications_url":"https://api.github.com/repos/madphysicist/scipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/madphysicist/scipy/labels{/name}","releases_url":"https://api.github.com/repos/madphysicist/scipy/releases{/id}","deployments_url":"https://api.github.com/repos/madphysicist/scipy/deployments","created_at":"2015-12-18T19:00:00Z","updated_at":"2016-01-29T15:00:45Z","pushed_at":"2016-02-04T20:55:48Z","git_url":"git://github.com/madphysicist/scipy.git","ssh_url":"git@github.com:madphysicist/scipy.git","clone_url":"https://github.com/madphysicist/scipy.git","svn_url":"https://github.com/madphysicist/scipy","homepage":"http://scipy.org/scipylib/","size":60378,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"scipy:master","ref":"master","sha":"a68a1589e4d0285a32de738f10fab974b83016a7","user":{"login":"scipy","id":288277,"avatar_url":"https://avatars.githubusercontent.com/u/288277?v=3","gravatar_id":"","url":"https://api.github.com/users/scipy","html_url":"https://github.com/scipy","followers_url":"https://api.github.com/users/scipy/followers","following_url":"https://api.github.com/users/scipy/following{/other_user}","gists_url":"https://api.github.com/users/scipy/gists{/gist_id}","starred_url":"https://api.github.com/users/scipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scipy/subscriptions","organizations_url":"https://api.github.com/users/scipy/orgs","repos_url":"https://api.github.com/users/scipy/repos","events_url":"https://api.github.com/users/scipy/events{/privacy}","received_events_url":"https://api.github.com/users/scipy/received_events","type":"Organization","site_admin":false},"repo":{"id":1460385,"name":"scipy","full_name":"scipy/scipy","owner":{"login":"scipy","id":288277,"avatar_url":"https://avatars.githubusercontent.com/u/288277?v=3","gravatar_id":"","url":"https://api.github.com/users/scipy","html_url":"https://github.com/scipy","followers_url":"https://api.github.com/users/scipy/followers","following_url":"https://api.github.com/users/scipy/following{/other_user}","gists_url":"https://api.github.com/users/scipy/gists{/gist_id}","starred_url":"https://api.github.com/users/scipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scipy/subscriptions","organizations_url":"https://api.github.com/users/scipy/orgs","repos_url":"https://api.github.com/users/scipy/repos","events_url":"https://api.github.com/users/scipy/events{/privacy}","received_events_url":"https://api.github.com/users/scipy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scipy/scipy","description":"Scipy library main repository","fork":false,"url":"https://api.github.com/repos/scipy/scipy","forks_url":"https://api.github.com/repos/scipy/scipy/forks","keys_url":"https://api.github.com/repos/scipy/scipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scipy/scipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scipy/scipy/teams","hooks_url":"https://api.github.com/repos/scipy/scipy/hooks","issue_events_url":"https://api.github.com/repos/scipy/scipy/issues/events{/number}","events_url":"https://api.github.com/repos/scipy/scipy/events","assignees_url":"https://api.github.com/repos/scipy/scipy/assignees{/user}","branches_url":"https://api.github.com/repos/scipy/scipy/branches{/branch}","tags_url":"https://api.github.com/repos/scipy/scipy/tags","blobs_url":"https://api.github.com/repos/scipy/scipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scipy/scipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scipy/scipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/scipy/scipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scipy/scipy/statuses/{sha}","languages_url":"https://api.github.com/repos/scipy/scipy/languages","stargazers_url":"https://api.github.com/repos/scipy/scipy/stargazers","contributors_url":"https://api.github.com/repos/scipy/scipy/contributors","subscribers_url":"https://api.github.com/repos/scipy/scipy/subscribers","subscription_url":"https://api.github.com/repos/scipy/scipy/subscription","commits_url":"https://api.github.com/repos/scipy/scipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/scipy/scipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/scipy/scipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/scipy/scipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/scipy/scipy/contents/{+path}","compare_url":"https://api.github.com/repos/scipy/scipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scipy/scipy/merges","archive_url":"https://api.github.com/repos/scipy/scipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scipy/scipy/downloads","issues_url":"https://api.github.com/repos/scipy/scipy/issues{/number}","pulls_url":"https://api.github.com/repos/scipy/scipy/pulls{/number}","milestones_url":"https://api.github.com/repos/scipy/scipy/milestones{/number}","notifications_url":"https://api.github.com/repos/scipy/scipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scipy/scipy/labels{/name}","releases_url":"https://api.github.com/repos/scipy/scipy/releases{/id}","deployments_url":"https://api.github.com/repos/scipy/scipy/deployments","created_at":"2011-03-09T18:52:03Z","updated_at":"2016-02-04T15:00:02Z","pushed_at":"2016-02-04T20:59:47Z","git_url":"git://github.com/scipy/scipy.git","ssh_url":"git@github.com:scipy/scipy.git","clone_url":"https://github.com/scipy/scipy.git","svn_url":"https://github.com/scipy/scipy","homepage":"http://scipy.org/scipylib/","size":70350,"stargazers_count":2083,"watchers_count":2083,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1203,"mirror_url":null,"open_issues_count":927,"forks":1203,"open_issues":927,"watchers":2083,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scipy/scipy/pulls/5808"},"html":{"href":"https://github.com/scipy/scipy/pull/5808"},"issue":{"href":"https://api.github.com/repos/scipy/scipy/issues/5808"},"comments":{"href":"https://api.github.com/repos/scipy/scipy/issues/5808/comments"},"review_comments":{"href":"https://api.github.com/repos/scipy/scipy/pulls/5808/comments"},"review_comment":{"href":"https://api.github.com/repos/scipy/scipy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scipy/scipy/pulls/5808/commits"},"statuses":{"href":"https://api.github.com/repos/scipy/scipy/statuses/7285db0dbd4859bc0fe46eb480221760ac348514"}}}}