{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/11892","labels_url":"https://api.github.com/repos/pydata/pandas/issues/11892/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/11892/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/11892/events","html_url":"https://github.com/pydata/pandas/pull/11892","id":123729850,"number":11892,"title":"ENH: RangeIndex redux","user":{"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},"labels":[{"url":"https://api.github.com/repos/pydata/pandas/labels/Enhancement","name":"Enhancement","color":"4E9A06"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Indexing","name":"Indexing","color":"0b02e1"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Performance","name":"Performance","color":"a10c02"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/36","html_url":"https://github.com/pydata/pandas/milestones/0.18.0","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/36/labels","id":1214851,"number":36,"title":"0.18.0","description":"","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":71,"closed_issues":155,"state":"open","created_at":"2015-07-19T20:18:45Z","updated_at":"2016-01-13T16:19:10Z","due_on":"2016-01-31T05:00:00Z","closed_at":null},"comments":70,"created_at":"2015-12-23T22:10:54Z","updated_at":"2016-01-13T18:40:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pydata/pandas/pulls/11892","html_url":"https://github.com/pydata/pandas/pull/11892","diff_url":"https://github.com/pydata/pandas/pull/11892.diff","patch_url":"https://github.com/pydata/pandas/pull/11892.patch"},"body":"closes #939 \r\nreplaces #9977 \r\n\r\nToDo:\r\n- [x] test for packers.py\r\n- [x] more code review\r\n\r\nMuch commentary on the original issue #9977 \r\n\r\nbut in essence ``RangeIndex`` is a complete replacement for ``Int64Index``, which all indexing semantics and interop. This is now the default indexer upon construction. It should be completely transparent to the end user.\r\n\r\nIt provides a constant memory footprint for any size of index. Their is a tiny penalty for < about 10 elements (which is actually trivial to fix, e.g. we could simply instantiate an ``Int64Index`` for these cases). But I think it is more natural to *always* get a ``RangeIndex``.\r\n\r\nOne other change here is to ``assert_index_equal`` the ``exact`` kw now takes ``equiv`` as the default (in addition to a boolean) to allow for exact comparisions except for ``Int64Index``/``RangeIndex`` are considered equivalent (as are string/unicode as inferred types, this was pre-existing).\r\n\r\n```\r\nIn [1]: s = Series(range(5))\r\n\r\nIn [2]: s.index\r\nOut[2]: RangeIndex(start=0, stop=5, step=1)\r\n\r\nIn [3]: s.nbytes\r\nOut[3]: 40\r\n\r\nIn [4]: s.index.nbytes\r\nOut[4]: 72\r\n\r\nIn [5]: s.index.astype(int).nbytes\r\nOut[5]: 40\r\n\r\nIn [6]: s = Series(range(100))\r\n\r\nIn [7]: s.index.astype(int).nbytes\r\nOut[7]: 800\r\n\r\nIn [8]: s.index.nbytes\r\nOut[8]: 72\r\n```"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/171393008","html_url":"https://github.com/pydata/pandas/pull/11892#issuecomment-171393008","issue_url":"https://api.github.com/repos/pydata/pandas/issues/11892","id":171393008,"user":{"login":"shoyer","id":1217238,"avatar_url":"https://avatars.githubusercontent.com/u/1217238?v=3","gravatar_id":"","url":"https://api.github.com/users/shoyer","html_url":"https://github.com/shoyer","followers_url":"https://api.github.com/users/shoyer/followers","following_url":"https://api.github.com/users/shoyer/following{/other_user}","gists_url":"https://api.github.com/users/shoyer/gists{/gist_id}","starred_url":"https://api.github.com/users/shoyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoyer/subscriptions","organizations_url":"https://api.github.com/users/shoyer/orgs","repos_url":"https://api.github.com/users/shoyer/repos","events_url":"https://api.github.com/users/shoyer/events{/privacy}","received_events_url":"https://api.github.com/users/shoyer/received_events","type":"User","site_admin":false},"created_at":"2016-01-13T18:40:34Z","updated_at":"2016-01-13T18:40:34Z","body":"> @shoyer Since RangeIndex is essentially an optimization, I think this is a legitimate case for the return type depending on values, not just types. Happy to be convinced otherwise though.\r\n\r\nThis is a fair point. I think we have two principled choices here:\r\n1. `RangeIndex` is just an optimized version of `Int64Index`. We make no guarantees about type stability for operations, but likewise RangeIndex has no new API compared to Int64Index -- so we should get rid of public `start`, `stop` and `step` attributes, as @jorisvandenbossche was advocating earlier.\r\n2. `RangeIndex` is a type stable variant of `Int64Index`. We can safely add new API (i.e., `start`, `stop`, `step`), because you always know whether an operation is going to return another `RangeIndex` or not. In practice, this would mean removing the possibility of creating a RangeIndex from the current operations that may or may not return a RangeIndex (e.g., set operations).\r\n\r\nCurrently, we are trying to have it both ways, is asking for trouble (bugs!). My vote would be for option 2 because I think it's nice to be able to look at `start`, `step` and `stop`, but I could get behind either option."}}