{"action":"opened","issue":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/23226","repository_url":"https://api.github.com/repos/pandas-dev/pandas","labels_url":"https://api.github.com/repos/pandas-dev/pandas/issues/23226/labels{/name}","comments_url":"https://api.github.com/repos/pandas-dev/pandas/issues/23226/comments","events_url":"https://api.github.com/repos/pandas-dev/pandas/issues/23226/events","html_url":"https://github.com/pandas-dev/pandas/issues/23226","id":371635410,"node_id":"MDU6SXNzdWUzNzE2MzU0MTA=","number":23226,"title":"Reindex error after df.loc + pd.pivot_table","user":{"login":"Sobes76rus","id":11739037,"node_id":"MDQ6VXNlcjExNzM5MDM3","avatar_url":"https://avatars2.githubusercontent.com/u/11739037?v=4","gravatar_id":"","url":"https://api.github.com/users/Sobes76rus","html_url":"https://github.com/Sobes76rus","followers_url":"https://api.github.com/users/Sobes76rus/followers","following_url":"https://api.github.com/users/Sobes76rus/following{/other_user}","gists_url":"https://api.github.com/users/Sobes76rus/gists{/gist_id}","starred_url":"https://api.github.com/users/Sobes76rus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sobes76rus/subscriptions","organizations_url":"https://api.github.com/users/Sobes76rus/orgs","repos_url":"https://api.github.com/users/Sobes76rus/repos","events_url":"https://api.github.com/users/Sobes76rus/events{/privacy}","received_events_url":"https://api.github.com/users/Sobes76rus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-18T17:34:39Z","updated_at":"2018-10-18T17:34:39Z","closed_at":null,"author_association":"NONE","body":"#### Code Sample, a copy-pastable example if possible\r\n\r\n```python\r\nimport pandas as pd\r\nimport numpy as np\r\n\r\ndf1 = pd.DataFrame(np.arange(9).reshape(3, 3), columns=['a', 'b', 'c'])\r\ndf2 = df1.loc[df1['a'] == 123]\r\n\r\ndf3 = pd.pivot_table(df2, 'a', 'b', 'c', aggfunc='sum')\r\ndf3.reindex(columns=['a', 'b', 'c'])\r\n```\r\n#### Problem description\r\n\r\n`df3` is `Empty DataFrame`\r\n```\r\nEmpty DataFrame\r\nColumns: []\r\nIndex: []\r\n```\r\n\r\n`pd.DataFrame().reindex(columns=['a', 'b', 'c'])` executed correctly. \r\nSo `df3.reindex(columns=['a', 'b', 'c'])` should be too, but instead raise exception\r\n\r\n#### Expected Output\r\n```\r\nEmpty DataFrame\r\nColumns: [a, b, c]\r\nIndex: []\r\n```\r\n\r\n#### Output of ``pd.show_versions()``\r\n\r\n<details>\r\n\r\ncommit: None\r\npython: 3.6.2.final.0\r\npython-bits: 64\r\nOS: Linux\r\nOS-release: 4.15.0-36-generic\r\nmachine: x86_64\r\nprocessor: x86_64\r\nbyteorder: little\r\nLC_ALL: None\r\nLANG: en_US.UTF-8\r\nLOCALE: en_US.UTF-8\r\n\r\npandas: 0.23.4\r\npytest: 3.1.2\r\npip: 9.0.1\r\nsetuptools: 36.4.0\r\nCython: 0.28.5\r\nnumpy: 1.15.2\r\nscipy: 1.1.0\r\npyarrow: None\r\nxarray: None\r\nIPython: 6.4.0\r\nsphinx: None\r\npatsy: None\r\ndateutil: 2.7.3\r\npytz: 2018.5\r\nblosc: None\r\nbottleneck: None\r\ntables: None\r\nnumexpr: None\r\nfeather: None\r\nmatplotlib: 2.2.2\r\nopenpyxl: None\r\nxlrd: 1.1.0\r\nxlwt: None\r\nxlsxwriter: 1.0.5\r\nlxml: None\r\nbs4: 4.6.3\r\nhtml5lib: 1.0.1\r\nsqlalchemy: None\r\npymysql: None\r\npsycopg2: None\r\njinja2: 2.10\r\ns3fs: None\r\nfastparquet: None\r\npandas_gbq: None\r\npandas_datareader: None\r\n\r\n</details>\r\n"}}
{"actor":{"display_login":"Sobes76rus"}}