{"action":"closed","number":9977,"pull_request":{"url":"https://api.github.com/repos/pydata/pandas/pulls/9977","id":34039686,"html_url":"https://github.com/pydata/pandas/pull/9977","diff_url":"https://github.com/pydata/pandas/pull/9977.diff","patch_url":"https://github.com/pydata/pandas/pull/9977.patch","issue_url":"https://api.github.com/repos/pydata/pandas/issues/9977","number":9977,"state":"closed","locked":false,"title":"Introduction of RangeIndex","user":{"login":"ARF1","id":5834577,"avatar_url":"https://avatars.githubusercontent.com/u/5834577?v=3","gravatar_id":"","url":"https://api.github.com/users/ARF1","html_url":"https://github.com/ARF1","followers_url":"https://api.github.com/users/ARF1/followers","following_url":"https://api.github.com/users/ARF1/following{/other_user}","gists_url":"https://api.github.com/users/ARF1/gists{/gist_id}","starred_url":"https://api.github.com/users/ARF1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARF1/subscriptions","organizations_url":"https://api.github.com/users/ARF1/orgs","repos_url":"https://api.github.com/users/ARF1/repos","events_url":"https://api.github.com/users/ARF1/events{/privacy}","received_events_url":"https://api.github.com/users/ARF1/received_events","type":"User","site_admin":false},"body":"closes #939\r\n \r\n`RangeIndex(1, 10, 2)` is a memory saving alternative to `Index(np.arange(1, 10,2))`: c.f. #939.\r\n\r\nThis re-implementation is compatible with the current `Index()` api and is a drop-in replacement for `Int64Index()`. It automatically converts to Int64Index() when required by operations.\r\n\r\nAt present only for a minimum number of operations the type is conserved (e.g. slicing, inner-, left- and right-joins). Most other operations trigger creation of an equivalent Int64Index (or at least an equivalent numpy array) and fall back to its implementation.\r\n\r\nThis PR also extends the functionality of the `Index()` constructor to allow creation of `RangeIndex()` with\r\n```\r\nIndex(20)\r\nIndex(2, 20)\r\nIndex(0, 20, 2)\r\n```\r\nin analogy to\r\n```\r\nrange(20)\r\nrange(2, 20)\r\nrange(0, 20, 2)\r\n```\r\n\r\n---\r\nTODO:\r\n - [x] Cache a private `Int64Index` object the first time it or its values are required.\r\n - [x] Restore `Index(5)` as error. Restore its test. Allow `Index(0, 5)` and `Index(0, 5, 1)`.\r\n - [x] Make `RangeIndex` immutable. See `start`, `stop`, `step` properties.\r\n - [x] In `test_constructor()`: check class, attributes (possibly including dtype).\r\n - [x] In `test_copy()`: check that copy is not identical (but equal) to the existing.\r\n - [ ] In `test_join_non_unique()`: test .append for ri.append(int64index) and int64index.append(ri).\r\n - [x] In `test_duplicates()`: Assert `is_unique` and `has_duplicates` return correct values.\r\n - [ ] After consensus on desired behaviour, adjust `test_view()`.\r\n - [ ] After consensus on constructor, adjust `test_constructor()` and possible add further tests.\r\n - [x] After consensus on `RangeIndex()` validity, adjust `test_pickle_compat_construction()`.\r\n - [ ] After consensus on slice behaviour, test for correct return type in `test_slice_specialised()`.\r\n - [ ] Accept `xrange` objects as input\r\n - [x] Setting `RangeIndex` as the default index.\r\n - [ ] Clean up `Index` constructor: use ABCs and named arguments\r\n - [ ] In `__getitem__()`: replace `np.isscalar` to exclude singe-element numpy arrays\r\n - [ ] Tests for `pandas.io.packers`\r\n\r\nIn need of consensus:\r\n - [x] If we disallow `Index(10)` should we also disallow `RangeIndex(10)`? That would seem like an unfortunate api break with respect to built-in `range()`,  `xrange()` and numpy `arange()`. *Decision: allow*\r\n - [x] Should `RangeIndex()` be allowed as a constructor alternative to the kludgy `Index(np.empty(0, dtype='...'))`? *Decision: allow*\r\n - [x] Should `RangeIndex` accept array inputs? If so, what should it do with them? Should it try to infer a corresponding `RangeIndex`? What should it do with inputs it cannot infer? *Decision: delegate all array inputs to `Int64Index`.*\r\n - [x] Should the `RangeIndex` constructor accept `dtype` as an argument? *Decision: accept, but only for array inputs.*\r\n - [x] If so, should it accept non-int64 dtypes as valid input? *Decision: Irrelevant due to delegation.* \r\n - [x] If so, does it need to check that the other inputs are within the range of the dtype? *Decision: Irrelevant due to delegation.*\r\n - [x] Related to constructor question, should slicing with a list return? Always `Int64Index` or `RangeIndex` when possible and `Int64Index` when not? *Decision: slicing with list will always return `Int64Index`.*\r\n - [ ] What should `RangeIndex(10).view('i8')` return? I believe `RangeIndex(10)`. *Decision: return `RangeIndex(10)`.*\r\n - [ ] What should `RangeIndex(10).view('i4')` return? I believe `Index(RangeIndex(10), dtype='i4')`. *Decision: return `Index(RangeIndex(10), dtype='i4')`.*\r\n","created_at":"2015-04-24T11:21:15Z","updated_at":"2015-12-30T15:39:31Z","closed_at":"2015-12-30T15:39:31Z","merged_at":null,"merge_commit_sha":"df7209d776b90d0e0a3b053745377f312c70c23f","assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/32","html_url":"https://github.com/pydata/pandas/milestones/Next%20Major%20Release","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/32/labels","id":933188,"number":32,"title":"Next Major Release","description":"after 0.16.1 of course","creator":{"login":"jreback","id":953992,"avatar_url":"https://avatars.githubusercontent.com/u/953992?v=3","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"open_issues":951,"closed_issues":107,"state":"open","created_at":"2015-01-13T10:53:19Z","updated_at":"2015-12-30T15:39:31Z","due_on":"2016-01-31T05:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/pydata/pandas/pulls/9977/commits","review_comments_url":"https://api.github.com/repos/pydata/pandas/pulls/9977/comments","review_comment_url":"https://api.github.com/repos/pydata/pandas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/9977/comments","statuses_url":"https://api.github.com/repos/pydata/pandas/statuses/c9ac12f6043dfc1aba8f871086b6c69b26940ba4","head":{"label":"ARF1:range_index_rebased","ref":"range_index_rebased","sha":"c9ac12f6043dfc1aba8f871086b6c69b26940ba4","user":{"login":"ARF1","id":5834577,"avatar_url":"https://avatars.githubusercontent.com/u/5834577?v=3","gravatar_id":"","url":"https://api.github.com/users/ARF1","html_url":"https://github.com/ARF1","followers_url":"https://api.github.com/users/ARF1/followers","following_url":"https://api.github.com/users/ARF1/following{/other_user}","gists_url":"https://api.github.com/users/ARF1/gists{/gist_id}","starred_url":"https://api.github.com/users/ARF1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARF1/subscriptions","organizations_url":"https://api.github.com/users/ARF1/orgs","repos_url":"https://api.github.com/users/ARF1/repos","events_url":"https://api.github.com/users/ARF1/events{/privacy}","received_events_url":"https://api.github.com/users/ARF1/received_events","type":"User","site_admin":false},"repo":{"id":34319082,"name":"pandas","full_name":"ARF1/pandas","owner":{"login":"ARF1","id":5834577,"avatar_url":"https://avatars.githubusercontent.com/u/5834577?v=3","gravatar_id":"","url":"https://api.github.com/users/ARF1","html_url":"https://github.com/ARF1","followers_url":"https://api.github.com/users/ARF1/followers","following_url":"https://api.github.com/users/ARF1/following{/other_user}","gists_url":"https://api.github.com/users/ARF1/gists{/gist_id}","starred_url":"https://api.github.com/users/ARF1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARF1/subscriptions","organizations_url":"https://api.github.com/users/ARF1/orgs","repos_url":"https://api.github.com/users/ARF1/repos","events_url":"https://api.github.com/users/ARF1/events{/privacy}","received_events_url":"https://api.github.com/users/ARF1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ARF1/pandas","description":"Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more","fork":true,"url":"https://api.github.com/repos/ARF1/pandas","forks_url":"https://api.github.com/repos/ARF1/pandas/forks","keys_url":"https://api.github.com/repos/ARF1/pandas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ARF1/pandas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ARF1/pandas/teams","hooks_url":"https://api.github.com/repos/ARF1/pandas/hooks","issue_events_url":"https://api.github.com/repos/ARF1/pandas/issues/events{/number}","events_url":"https://api.github.com/repos/ARF1/pandas/events","assignees_url":"https://api.github.com/repos/ARF1/pandas/assignees{/user}","branches_url":"https://api.github.com/repos/ARF1/pandas/branches{/branch}","tags_url":"https://api.github.com/repos/ARF1/pandas/tags","blobs_url":"https://api.github.com/repos/ARF1/pandas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ARF1/pandas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ARF1/pandas/git/refs{/sha}","trees_url":"https://api.github.com/repos/ARF1/pandas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ARF1/pandas/statuses/{sha}","languages_url":"https://api.github.com/repos/ARF1/pandas/languages","stargazers_url":"https://api.github.com/repos/ARF1/pandas/stargazers","contributors_url":"https://api.github.com/repos/ARF1/pandas/contributors","subscribers_url":"https://api.github.com/repos/ARF1/pandas/subscribers","subscription_url":"https://api.github.com/repos/ARF1/pandas/subscription","commits_url":"https://api.github.com/repos/ARF1/pandas/commits{/sha}","git_commits_url":"https://api.github.com/repos/ARF1/pandas/git/commits{/sha}","comments_url":"https://api.github.com/repos/ARF1/pandas/comments{/number}","issue_comment_url":"https://api.github.com/repos/ARF1/pandas/issues/comments{/number}","contents_url":"https://api.github.com/repos/ARF1/pandas/contents/{+path}","compare_url":"https://api.github.com/repos/ARF1/pandas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ARF1/pandas/merges","archive_url":"https://api.github.com/repos/ARF1/pandas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ARF1/pandas/downloads","issues_url":"https://api.github.com/repos/ARF1/pandas/issues{/number}","pulls_url":"https://api.github.com/repos/ARF1/pandas/pulls{/number}","milestones_url":"https://api.github.com/repos/ARF1/pandas/milestones{/number}","notifications_url":"https://api.github.com/repos/ARF1/pandas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ARF1/pandas/labels{/name}","releases_url":"https://api.github.com/repos/ARF1/pandas/releases{/id}","created_at":"2015-04-21T10:00:44Z","updated_at":"2015-04-21T10:00:49Z","pushed_at":"2015-05-07T12:31:05Z","git_url":"git://github.com/ARF1/pandas.git","ssh_url":"git@github.com:ARF1/pandas.git","clone_url":"https://github.com/ARF1/pandas.git","svn_url":"https://github.com/ARF1/pandas","homepage":"http://pandas.pydata.org","size":51428,"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":"pydata:master","ref":"master","sha":"76571d03562ca5e87b0b27a8664ce75b7bbdb65d","user":{"login":"pydata","id":1284191,"avatar_url":"https://avatars.githubusercontent.com/u/1284191?v=3","gravatar_id":"","url":"https://api.github.com/users/pydata","html_url":"https://github.com/pydata","followers_url":"https://api.github.com/users/pydata/followers","following_url":"https://api.github.com/users/pydata/following{/other_user}","gists_url":"https://api.github.com/users/pydata/gists{/gist_id}","starred_url":"https://api.github.com/users/pydata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pydata/subscriptions","organizations_url":"https://api.github.com/users/pydata/orgs","repos_url":"https://api.github.com/users/pydata/repos","events_url":"https://api.github.com/users/pydata/events{/privacy}","received_events_url":"https://api.github.com/users/pydata/received_events","type":"Organization","site_admin":false},"repo":{"id":858127,"name":"pandas","full_name":"pydata/pandas","owner":{"login":"pydata","id":1284191,"avatar_url":"https://avatars.githubusercontent.com/u/1284191?v=3","gravatar_id":"","url":"https://api.github.com/users/pydata","html_url":"https://github.com/pydata","followers_url":"https://api.github.com/users/pydata/followers","following_url":"https://api.github.com/users/pydata/following{/other_user}","gists_url":"https://api.github.com/users/pydata/gists{/gist_id}","starred_url":"https://api.github.com/users/pydata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pydata/subscriptions","organizations_url":"https://api.github.com/users/pydata/orgs","repos_url":"https://api.github.com/users/pydata/repos","events_url":"https://api.github.com/users/pydata/events{/privacy}","received_events_url":"https://api.github.com/users/pydata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pydata/pandas","description":"Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more","fork":false,"url":"https://api.github.com/repos/pydata/pandas","forks_url":"https://api.github.com/repos/pydata/pandas/forks","keys_url":"https://api.github.com/repos/pydata/pandas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pydata/pandas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pydata/pandas/teams","hooks_url":"https://api.github.com/repos/pydata/pandas/hooks","issue_events_url":"https://api.github.com/repos/pydata/pandas/issues/events{/number}","events_url":"https://api.github.com/repos/pydata/pandas/events","assignees_url":"https://api.github.com/repos/pydata/pandas/assignees{/user}","branches_url":"https://api.github.com/repos/pydata/pandas/branches{/branch}","tags_url":"https://api.github.com/repos/pydata/pandas/tags","blobs_url":"https://api.github.com/repos/pydata/pandas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pydata/pandas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pydata/pandas/git/refs{/sha}","trees_url":"https://api.github.com/repos/pydata/pandas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pydata/pandas/statuses/{sha}","languages_url":"https://api.github.com/repos/pydata/pandas/languages","stargazers_url":"https://api.github.com/repos/pydata/pandas/stargazers","contributors_url":"https://api.github.com/repos/pydata/pandas/contributors","subscribers_url":"https://api.github.com/repos/pydata/pandas/subscribers","subscription_url":"https://api.github.com/repos/pydata/pandas/subscription","commits_url":"https://api.github.com/repos/pydata/pandas/commits{/sha}","git_commits_url":"https://api.github.com/repos/pydata/pandas/git/commits{/sha}","comments_url":"https://api.github.com/repos/pydata/pandas/comments{/number}","issue_comment_url":"https://api.github.com/repos/pydata/pandas/issues/comments{/number}","contents_url":"https://api.github.com/repos/pydata/pandas/contents/{+path}","compare_url":"https://api.github.com/repos/pydata/pandas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pydata/pandas/merges","archive_url":"https://api.github.com/repos/pydata/pandas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pydata/pandas/downloads","issues_url":"https://api.github.com/repos/pydata/pandas/issues{/number}","pulls_url":"https://api.github.com/repos/pydata/pandas/pulls{/number}","milestones_url":"https://api.github.com/repos/pydata/pandas/milestones{/number}","notifications_url":"https://api.github.com/repos/pydata/pandas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pydata/pandas/labels{/name}","releases_url":"https://api.github.com/repos/pydata/pandas/releases{/id}","created_at":"2010-08-24T01:37:33Z","updated_at":"2015-12-30T13:14:24Z","pushed_at":"2015-12-30T14:24:08Z","git_url":"git://github.com/pydata/pandas.git","ssh_url":"git@github.com:pydata/pandas.git","clone_url":"https://github.com/pydata/pandas.git","svn_url":"https://github.com/pydata/pandas","homepage":"http://pandas.pydata.org","size":130707,"stargazers_count":5506,"watchers_count":5506,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2169,"mirror_url":null,"open_issues_count":1559,"forks":2169,"open_issues":1559,"watchers":5506,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pydata/pandas/pulls/9977"},"html":{"href":"https://github.com/pydata/pandas/pull/9977"},"issue":{"href":"https://api.github.com/repos/pydata/pandas/issues/9977"},"comments":{"href":"https://api.github.com/repos/pydata/pandas/issues/9977/comments"},"review_comments":{"href":"https://api.github.com/repos/pydata/pandas/pulls/9977/comments"},"review_comment":{"href":"https://api.github.com/repos/pydata/pandas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pydata/pandas/pulls/9977/commits"},"statuses":{"href":"https://api.github.com/repos/pydata/pandas/statuses/c9ac12f6043dfc1aba8f871086b6c69b26940ba4"}},"merged":false,"mergeable":false,"mergeable_state":"dirty","merged_by":null,"comments":18,"review_comments":46,"commits":7,"additions":1049,"deletions":23,"changed_files":7}}