{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/9668","labels_url":"https://api.github.com/repos/pydata/pandas/issues/9668/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/9668/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/9668/events","html_url":"https://github.com/pydata/pandas/issues/9668","id":62278130,"number":9668,"title":"Index with Categorical dtype","user":{"login":"mrocklin","id":306380,"avatar_url":"https://avatars.githubusercontent.com/u/306380?v=3","gravatar_id":"","url":"https://api.github.com/users/mrocklin","html_url":"https://github.com/mrocklin","followers_url":"https://api.github.com/users/mrocklin/followers","following_url":"https://api.github.com/users/mrocklin/following{/other_user}","gists_url":"https://api.github.com/users/mrocklin/gists{/gist_id}","starred_url":"https://api.github.com/users/mrocklin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrocklin/subscriptions","organizations_url":"https://api.github.com/users/mrocklin/orgs","repos_url":"https://api.github.com/users/mrocklin/repos","events_url":"https://api.github.com/users/mrocklin/events{/privacy}","received_events_url":"https://api.github.com/users/mrocklin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-17T03:54:16Z","updated_at":"2015-03-17T10:27:45Z","closed_at":"2015-03-17T10:27:45Z","body":"Currently categorical data is converted to full form when made an index.\r\n\r\n```python\r\nIn [1]: import pandas as pd\r\n\r\nIn [2]: df = pd.DataFrame({'a': pd.Categorical(['a', 'b', 'a'])}, \r\n...                       index=pd.Categorical(['a', 'b', 'a'])) \r\nIn [3]: df.dtypes \r\nOut[3]: \r\na    category\r\ndtype: object\r\n\r\nIn [4]: df.index.dtype \r\nOut[4]: dtype('O')\r\n\r\nIn [5]: df.index \r\nOut[5]: Index([u'a', u'b', u'a'], dtype='object')\r\n```\r\n\r\nIs there a way around this?  I'm trying to keep my DataFrames free of object dtypes to reduce serialization costs.  I would like to index off of a text column using categoricals.\r\n\r\nThis is with `0.15.2`"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/82261724","html_url":"https://github.com/pydata/pandas/issues/9668#issuecomment-82261724","issue_url":"https://api.github.com/repos/pydata/pandas/issues/9668","id":82261724,"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},"created_at":"2015-03-17T10:27:45Z","updated_at":"2015-03-17T10:27:45Z","body":"requested in #7642 already\r\n\r\nbest way is simply to leave it as a coulumn and not set the index; it will then be serialized as a ``Categorical`` type"}}