{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/13151","repository_url":"https://api.github.com/repos/pydata/pandas","labels_url":"https://api.github.com/repos/pydata/pandas/issues/13151/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/13151/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/13151/events","html_url":"https://github.com/pydata/pandas/issues/13151","id":154392865,"number":13151,"title":"why resample with group by not pad null value","user":{"login":"starplanet","id":11285770,"avatar_url":"https://avatars.githubusercontent.com/u/11285770?v=3","gravatar_id":"","url":"https://api.github.com/users/starplanet","html_url":"https://github.com/starplanet","followers_url":"https://api.github.com/users/starplanet/followers","following_url":"https://api.github.com/users/starplanet/following{/other_user}","gists_url":"https://api.github.com/users/starplanet/gists{/gist_id}","starred_url":"https://api.github.com/users/starplanet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starplanet/subscriptions","organizations_url":"https://api.github.com/users/starplanet/orgs","repos_url":"https://api.github.com/users/starplanet/repos","events_url":"https://api.github.com/users/starplanet/events{/privacy}","received_events_url":"https://api.github.com/users/starplanet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-12T04:07:14Z","updated_at":"2016-05-12T10:15:48Z","closed_at":null,"body":"#### Code Sample, a copy-pastable example if possible\r\n\r\nI use resample with group by method to run following code:\r\n\r\n```\r\nimport pandas as pd\r\ndata = [{'buyer_id': 1, 'pay_time': '2016-01-01', 'tid': '11'}, {'buyer_id': 1, 'pay_time': '2016-01-03', 'tid': '12'}, {'buyer_id': 1, 'pay_time': '2016-01-05', 'tid': '13'}, {'buyer_id': 2, 'pay_time': '2016-01-01', 'tid': '21'}, {'buyer_id': 2, 'pay_time': '2016-01-02', 'tid': '22'}, {'buyer_id': 2, 'pay_time': '2016-01-05', 'tid': '23'}]\r\n\r\ndf['pay_time'] = pd.to_datetime(df['pay_time'])\r\ndf.set_index('pay_time').groupby('buyer_id').resample('1D').count()\r\n```\r\n\r\nprogram output like following:\r\n```\r\n                     buyer_id  tid\r\nbuyer_id pay_time\r\n1        2016-01-01         1    1\r\n          2016-01-03         1    1\r\n          2016-01-05         1    1\r\n2        2016-01-01         1    1\r\n         2016-01-02         1    1\r\n         2016-01-05         1    1\r\n```\r\n\r\nbut I want the output could pad the missing data with 0 like this:\r\n\r\n```\r\n                     buyer_id  tid\r\nbuyer_id pay_time\r\n1        2016-01-01         1    1\r\n          2016-01-02         0  0\r\n          2016-01-03         1    1\r\n          2016-01-04         0  0\r\n          2016-01-05         1    1\r\n2        2016-01-01         1    1\r\n         2016-01-02         1    1\r\n         2016-01-03        0  0\r\n         2016-01-04        0  0\r\n         2016-01-05         1    1\r\n```\r\nIf I don't use groupby method, resample can pad missing data with 0, like this:\r\n\r\n```\r\ndf.set_index('pay_time').resample('1D').count()\r\n\r\n            buyer_id  tid\r\npay_time\r\n2016-01-01         2    2\r\n2016-01-02         1    1\r\n2016-01-03         1    1\r\n2016-01-04         0    0\r\n2016-01-05         2    2\r\n```\r\n\r\nI don't know why the behavior of using resample alone is different with resample with group by.\r\n\r\n#### output of ``pd.show_versions()``\r\n\r\nNSTALLED VERSIONS\r\n------------------\r\ncommit: None\r\npython: 2.7.11.final.0\r\npython-bits: 64\r\nOS: Darwin\r\nOS-release: 15.4.0\r\nmachine: x86_64\r\nprocessor: i386\r\nbyteorder: little\r\nLC_ALL: None\r\nLANG: zh_CN.UTF-8\r\n\r\npandas: 0.18.0\r\nnose: None\r\npip: 8.1.1\r\nsetuptools: 19.4\r\nCython: None\r\nnumpy: 1.11.0\r\nscipy: None\r\nstatsmodels: None\r\nxarray: None\r\nIPython: 4.2.0\r\nsphinx: 1.3.5\r\npatsy: None\r\ndateutil: 2.5.3\r\npytz: 2016.4\r\nblosc: None\r\nbottleneck: None\r\ntables: None\r\nnumexpr: None\r\nmatplotlib: None\r\nopenpyxl: None\r\nxlrd: None\r\nxlwt: None\r\nxlsxwriter: None\r\nlxml: None\r\nbs4: 4.4.1\r\nhtml5lib: None\r\nhttplib2: None\r\napiclient: None\r\nsqlalchemy: 1.0.12\r\npymysql: None\r\npsycopg2: None\r\njinja2: 2.8\r\nboto: None"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/218716481","html_url":"https://github.com/pydata/pandas/issues/13151#issuecomment-218716481","issue_url":"https://api.github.com/repos/pydata/pandas/issues/13151","id":218716481,"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},"created_at":"2016-05-12T10:15:48Z","updated_at":"2016-05-12T10:15:48Z","body":"Probably fixed by #12743"}}