{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/9528","labels_url":"https://api.github.com/repos/pydata/pandas/issues/9528/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/9528/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/9528/events","html_url":"https://github.com/pydata/pandas/issues/9528","id":58283934,"number":9528,"title":"BUG: Resample upsampling return NaNs","user":{"login":"KevinLourd","id":10365689,"avatar_url":"https://avatars.githubusercontent.com/u/10365689?v=3","gravatar_id":"","url":"https://api.github.com/users/KevinLourd","html_url":"https://github.com/KevinLourd","followers_url":"https://api.github.com/users/KevinLourd/followers","following_url":"https://api.github.com/users/KevinLourd/following{/other_user}","gists_url":"https://api.github.com/users/KevinLourd/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinLourd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinLourd/subscriptions","organizations_url":"https://api.github.com/users/KevinLourd/orgs","repos_url":"https://api.github.com/users/KevinLourd/repos","events_url":"https://api.github.com/users/KevinLourd/events{/privacy}","received_events_url":"https://api.github.com/users/KevinLourd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-19T22:57:28Z","updated_at":"2015-02-19T23:06:29Z","closed_at":null,"body":"Pandas resample bugs when upsampling a time serie with same size splits :\r\n\r\nFor instance, I have a time serie of **size 10**:\r\n```\r\nrng = pd.date_range('20130101',periods=10,freq='T')\r\nts=pd.Series(np.random.randn(len(rng)), index=rng)\r\n```\r\n`print(ts)`\r\n```\r\n2013-01-01 00:00:00   -1.811999\r\n2013-01-01 00:01:00   -0.890837\r\n2013-01-01 00:02:00   -0.363520\r\n2013-01-01 00:03:00   -0.026245\r\n2013-01-01 00:04:00    1.515072\r\n2013-01-01 00:05:00    0.920129\r\n2013-01-01 00:06:00   -0.125954\r\n2013-01-01 00:07:00    0.588933\r\n2013-01-01 00:08:00   -1.278408\r\n2013-01-01 00:09:00   -0.172525\r\nFreq: T, dtype: float64\r\n```\r\n\r\nWhen trying to resample in **N > 10** parts it doesn't work:\r\n```\r\nlength = 11\r\ntimeSpan = (ts.index[-1]-ts.index[0]+timedelta(minutes=1))\r\nrule = int(timeSpan.total_seconds()/length)\r\ntsNew=ts.resample(str(rule)+\"S\")\r\n```\r\n`print(tsNew)`\r\n```\r\n2013-01-01 00:00:00    1.845181\r\n2013-01-01 00:00:54         NaN\r\n2013-01-01 00:01:48         NaN\r\n2013-01-01 00:02:42         NaN\r\n2013-01-01 00:03:36         NaN\r\n2013-01-01 00:04:30         NaN\r\n2013-01-01 00:05:24         NaN\r\n2013-01-01 00:06:18         NaN\r\n2013-01-01 00:07:12         NaN\r\n2013-01-01 00:08:06         NaN\r\n2013-01-01 00:09:00   -0.997419\r\nFreq: 54S, dtype: float64\r\n```\r\n\r\nNote: here is my versions:\r\n`pd.show_versions()`\r\n```\r\nINSTALLED VERSIONS\r\n------------------\r\ncommit: None\r\npython: 3.4.2.final.0\r\npython-bits: 64\r\nOS: Darwin\r\nOS-release: 14.1.0\r\nmachine: x86_64\r\nprocessor: i386\r\nbyteorder: little\r\nLC_ALL: None\r\nLANG: en_US.UTF-8\r\n\r\npandas: 0.15.2\r\nnose: 1.3.4\r\nCython: 0.21\r\nnumpy: 1.9.1\r\nscipy: 0.15.1\r\nstatsmodels: 0.5.0\r\nIPython: 2.3.1\r\nsphinx: 1.2.3\r\npatsy: 0.3.0\r\ndateutil: 2.1\r\npytz: 2014.9\r\nbottleneck: None\r\ntables: 3.1.1\r\nnumexpr: 2.3.1\r\nmatplotlib: 1.4.0\r\nopenpyxl: 1.8.5\r\nxlrd: 0.9.3\r\nxlwt: None\r\nxlsxwriter: 0.5.7\r\nlxml: 3.4.0\r\nbs4: 4.3.2\r\nhtml5lib: None\r\nhttplib2: None\r\napiclient: None\r\nrpy2: None\r\nsqlalchemy: 0.9.7\r\npymysql: 0.6.3.None\r\npsycopg2: None\r\n```\r\n\r\nThank you for your help"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/75158340","html_url":"https://github.com/pydata/pandas/issues/9528#issuecomment-75158340","issue_url":"https://api.github.com/repos/pydata/pandas/issues/9528","id":75158340,"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-02-19T23:06:29Z","updated_at":"2015-02-19T23:06:29Z","body":"I don't think this is a bug per se, rather a convention / api issue.\r\n\r\nIIRC (and i'll have to look further), it is actually reindexing here. (that's why the stamps that match with your original have values, but the others don't).\r\n\r\nDoesn't seem very useful though.\r\n\r\n```\r\nIn [8]: ts.resample('54s',how='mean')\r\nOut[8]: \r\n2013-01-01 00:00:00     0\r\n2013-01-01 00:00:54     1\r\n2013-01-01 00:01:48     2\r\n2013-01-01 00:02:42     3\r\n2013-01-01 00:03:36     4\r\n2013-01-01 00:04:30     5\r\n2013-01-01 00:05:24     6\r\n2013-01-01 00:06:18     7\r\n2013-01-01 00:07:12     8\r\n2013-01-01 00:08:06   NaN\r\n2013-01-01 00:09:00     9\r\nFreq: 54S, dtype: float64\r\n\r\nIn [9]: ts.resample('54s')\r\nOut[9]: \r\n2013-01-01 00:00:00     0\r\n2013-01-01 00:00:54   NaN\r\n2013-01-01 00:01:48   NaN\r\n2013-01-01 00:02:42   NaN\r\n2013-01-01 00:03:36   NaN\r\n2013-01-01 00:04:30   NaN\r\n2013-01-01 00:05:24   NaN\r\n2013-01-01 00:06:18   NaN\r\n2013-01-01 00:07:12   NaN\r\n2013-01-01 00:08:06   NaN\r\n2013-01-01 00:09:00     9\r\nFreq: 54S, dtype: float64\r\n```"}}