{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/9892","labels_url":"https://api.github.com/repos/pydata/pandas/issues/9892/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/9892/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/9892/events","html_url":"https://github.com/pydata/pandas/issues/9892","id":68359676,"number":9892,"title":"BUG: indexing with string in multi-index for Period gives KeyError","user":{"login":"jorisvandenbossche","id":1020496,"avatar_url":"https://avatars.githubusercontent.com/u/1020496?v=3","gravatar_id":"","url":"https://api.github.com/users/jorisvandenbossche","html_url":"https://github.com/jorisvandenbossche","followers_url":"https://api.github.com/users/jorisvandenbossche/followers","following_url":"https://api.github.com/users/jorisvandenbossche/following{/other_user}","gists_url":"https://api.github.com/users/jorisvandenbossche/gists{/gist_id}","starred_url":"https://api.github.com/users/jorisvandenbossche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jorisvandenbossche/subscriptions","organizations_url":"https://api.github.com/users/jorisvandenbossche/orgs","repos_url":"https://api.github.com/users/jorisvandenbossche/repos","events_url":"https://api.github.com/users/jorisvandenbossche/events{/privacy}","received_events_url":"https://api.github.com/users/jorisvandenbossche/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pydata/pandas/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/pydata/pandas/labels/MultiIndex","name":"MultiIndex","color":"207de5"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Period","name":"Period","color":"eb6420"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Regression","name":"Regression","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/29","html_url":"https://github.com/pydata/pandas/milestones/0.16.1","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/29/labels","id":816810,"number":29,"title":"0.16.1","description":"after 0.16.0 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":109,"closed_issues":100,"state":"open","created_at":"2014-10-07T14:39:07Z","updated_at":"2015-04-14T14:29:25Z","due_on":"2015-04-30T07:00:00Z","closed_at":null},"comments":4,"created_at":"2015-04-14T12:41:23Z","updated_at":"2015-04-14T14:56:40Z","closed_at":null,"body":"From [SO](http://stackoverflow.com/questions/29627143/setting-value-in-pandas-mulitindex-fails/29627444#29627444): \r\n\r\n```\r\nimport pandas as pd\r\nimport itertools\r\na = pd.period_range('2013Q1','2013Q4', freq='Q')\r\ni = (1111, 2222, 3333)\r\nidx = pd.MultiIndex.from_tuples(list(itertools.product(a, i)),\r\n                            names=('Periode', 'CVR'))\r\ndf = pd.DataFrame(index=idx,\r\n              columns=('OMS', 'OMK','RES','DRIFT_IND','OEVRIG_IND','FIN_IND','VARE_UD','LOEN_UD','FIN_UD'))\r\n```\r\n\r\nTrying to select with a string gives a ValueError:\r\n\r\n```\r\nIn [15]: df.loc[('2013Q1',1111),'OMS']\r\n---------------------------------------------------------------------------\r\nKeyError: ('2013Q1', 1111)\r\n```\r\n\r\nwhile it works with an explicit Period:\r\n```\r\nIn [16]: df.loc[(pd.Period('2013Q1'),1111),'OMS']\r\nOut[16]: nan\r\n```\r\n\r\nand it also works when not using multi-index notation (only accessing the first level): `df.loc['2013Q1', 'OMS']`\r\n\r\nand this **did work in 0.14.1**."},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/92890856","html_url":"https://github.com/pydata/pandas/issues/9892#issuecomment-92890856","issue_url":"https://api.github.com/repos/pydata/pandas/issues/9892","id":92890856,"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-04-14T14:56:40Z","updated_at":"2015-04-14T14:56:40Z","body":"hmm, ok, Period does need a bit of attention "}}