{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/9212","labels_url":"https://api.github.com/repos/pydata/pandas/issues/9212/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/9212/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/9212/events","html_url":"https://github.com/pydata/pandas/issues/9212","id":53730230,"number":9212,"title":"sort_index behavior differs for the same DataFrame?","user":{"login":"tlmaloney","id":1243750,"avatar_url":"https://avatars.githubusercontent.com/u/1243750?v=3","gravatar_id":"","url":"https://api.github.com/users/tlmaloney","html_url":"https://github.com/tlmaloney","followers_url":"https://api.github.com/users/tlmaloney/followers","following_url":"https://api.github.com/users/tlmaloney/following{/other_user}","gists_url":"https://api.github.com/users/tlmaloney/gists{/gist_id}","starred_url":"https://api.github.com/users/tlmaloney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlmaloney/subscriptions","organizations_url":"https://api.github.com/users/tlmaloney/orgs","repos_url":"https://api.github.com/users/tlmaloney/repos","events_url":"https://api.github.com/users/tlmaloney/events{/privacy}","received_events_url":"https://api.github.com/users/tlmaloney/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-08T09:28:20Z","updated_at":"2015-01-08T09:37:48Z","closed_at":null,"body":"I feel like I've encountered a bug. In the following scenario, the first `sort_index` call behaves as expected, but the second does not. Does someone know what the difference is here?\r\n\r\n```\r\nIn [1]: import pandas as pd\r\n\r\nIn [2]: pd.__version__\r\nOut[2]: '0.15.2'\r\n\r\nIn [3]: tuples = [(' foo', 'bar'), ('foo', 'bar'), (' foo ()', 'bar')]\r\n\r\nIn [4]: cols = pd.MultiIndex.from_tuples(tuples)\r\n\r\nIn [5]: df = pd.DataFrame(index=cols, data={'baz': [0, 1, 2]})\r\n\r\nIn [6]: df\r\nOut[6]: \r\n             baz\r\n foo    bar    0\r\nfoo     bar    1\r\n foo () bar    2\r\n\r\nIn [7]: df.sort_index()\r\nOut[7]: \r\n             baz\r\n foo    bar    0\r\n foo () bar    2\r\nfoo     bar    1\r\n\r\nIn [8]: tuples = [(' foo', 'bar'), ('foo', 'bar')]\r\n\r\nIn [9]: cols = pd.MultiIndex.from_tuples(tuples)\r\n\r\nIn [10]: df = pd.DataFrame(index=cols, data={'baz': [0, 1]})\r\n\r\nIn [11]: df\r\nOut[11]: \r\n          baz\r\n foo bar    0\r\nfoo  bar    1\r\n\r\nIn [12]: df.ix[(' foo ()', 'bar'), 'baz'] = 2\r\n\r\nIn [13]: df\r\nOut[13]: \r\n             baz\r\n foo    bar    0\r\nfoo     bar    1\r\n foo () bar    2\r\n\r\nIn [14]: df.sort_index()\r\nOut[14]: \r\n             baz\r\n foo    bar    0\r\nfoo     bar    1\r\n foo () bar    2\r\n```"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/69156107","html_url":"https://github.com/pydata/pandas/issues/9212#issuecomment-69156107","issue_url":"https://api.github.com/repos/pydata/pandas/issues/9212","id":69156107,"user":{"login":"tlmaloney","id":1243750,"avatar_url":"https://avatars.githubusercontent.com/u/1243750?v=3","gravatar_id":"","url":"https://api.github.com/users/tlmaloney","html_url":"https://github.com/tlmaloney","followers_url":"https://api.github.com/users/tlmaloney/followers","following_url":"https://api.github.com/users/tlmaloney/following{/other_user}","gists_url":"https://api.github.com/users/tlmaloney/gists{/gist_id}","starred_url":"https://api.github.com/users/tlmaloney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlmaloney/subscriptions","organizations_url":"https://api.github.com/users/tlmaloney/orgs","repos_url":"https://api.github.com/users/tlmaloney/repos","events_url":"https://api.github.com/users/tlmaloney/events{/privacy}","received_events_url":"https://api.github.com/users/tlmaloney/received_events","type":"User","site_admin":false},"created_at":"2015-01-08T09:37:48Z","updated_at":"2015-01-08T09:37:48Z","body":"FWIW:\r\n\r\n```\r\n#!bash\r\n~\r\ntmaloney@aal-lpc-2-03$  locale\r\nLANG=en_US.UTF-8\r\nLANGUAGE=\r\nLC_CTYPE=\"en_US.UTF-8\"\r\nLC_NUMERIC=\"en_US.UTF-8\"\r\nLC_TIME=\"en_US.UTF-8\"\r\nLC_COLLATE=\"en_US.UTF-8\"\r\nLC_MONETARY=\"en_US.UTF-8\"\r\nLC_MESSAGES=\"en_US.UTF-8\"\r\nLC_PAPER=\"en_US.UTF-8\"\r\nLC_NAME=\"en_US.UTF-8\"\r\nLC_ADDRESS=\"en_US.UTF-8\"\r\nLC_TELEPHONE=\"en_US.UTF-8\"\r\nLC_MEASUREMENT=\"en_US.UTF-8\"\r\nLC_IDENTIFICATION=\"en_US.UTF-8\"\r\nLC_ALL=\r\n```"}}