{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/10691","labels_url":"https://api.github.com/repos/pydata/pandas/issues/10691/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/10691/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/10691/events","html_url":"https://github.com/pydata/pandas/pull/10691","id":97782950,"number":10691,"title":"Allow interpolate() to fill backwards as well as forwards","user":{"login":"lmjohns3","id":53048,"avatar_url":"https://avatars.githubusercontent.com/u/53048?v=3","gravatar_id":"","url":"https://api.github.com/users/lmjohns3","html_url":"https://github.com/lmjohns3","followers_url":"https://api.github.com/users/lmjohns3/followers","following_url":"https://api.github.com/users/lmjohns3/following{/other_user}","gists_url":"https://api.github.com/users/lmjohns3/gists{/gist_id}","starred_url":"https://api.github.com/users/lmjohns3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmjohns3/subscriptions","organizations_url":"https://api.github.com/users/lmjohns3/orgs","repos_url":"https://api.github.com/users/lmjohns3/repos","events_url":"https://api.github.com/users/lmjohns3/events{/privacy}","received_events_url":"https://api.github.com/users/lmjohns3/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pydata/pandas/labels/API%20Design","name":"API Design","color":"AD7FA8"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Missing-data","name":"Missing-data","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/34","html_url":"https://github.com/pydata/pandas/milestones/0.17.0","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/34/labels","id":1033710,"number":34,"title":"0.17.0","description":"","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":126,"closed_issues":289,"state":"open","created_at":"2015-03-23T10:47:38Z","updated_at":"2015-08-18T11:20:29Z","due_on":"2015-08-31T04:00:00Z","closed_at":null},"comments":28,"created_at":"2015-07-28T19:26:37Z","updated_at":"2015-08-18T18:12:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pydata/pandas/pulls/10691","html_url":"https://github.com/pydata/pandas/pull/10691","diff_url":"https://github.com/pydata/pandas/pull/10691.diff","patch_url":"https://github.com/pydata/pandas/pull/10691.patch"},"body":"closes #9218\r\ncloses #10420 \r\n\r\n**Edit: changed approach, see the rest of the thread**\r\n\r\nCurrently, interpolate() has a \"limit\" kwarg that, when set to n,\r\nprevents interpolated values from propagating more than n rows forward.\r\n\r\nThis change adds a \"backward_limit\" kwarg that, when set to n, prevents\r\ninterpolated values from propagating more than n rows backward.\r\n\r\nThe behavior prior to this change is as though \"backward_limit\" existed\r\nbut was always set to 0. That is, interpolated values never filled in\r\nNaNs immediately before a non-NaN value (unless those same NaNs happened\r\nto follow a different, non-NaN value within \"limit\" rows).\r\n\r\nIn this change the \"backward_limit\" kwarg has no effect if \"limit\" is\r\nnot specified (i.e., None).\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/132303958","html_url":"https://github.com/pydata/pandas/pull/10691#issuecomment-132303958","issue_url":"https://api.github.com/repos/pydata/pandas/issues/10691","id":132303958,"user":{"login":"shoyer","id":1217238,"avatar_url":"https://avatars.githubusercontent.com/u/1217238?v=3","gravatar_id":"","url":"https://api.github.com/users/shoyer","html_url":"https://github.com/shoyer","followers_url":"https://api.github.com/users/shoyer/followers","following_url":"https://api.github.com/users/shoyer/following{/other_user}","gists_url":"https://api.github.com/users/shoyer/gists{/gist_id}","starred_url":"https://api.github.com/users/shoyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoyer/subscriptions","organizations_url":"https://api.github.com/users/shoyer/orgs","repos_url":"https://api.github.com/users/shoyer/repos","events_url":"https://api.github.com/users/shoyer/events{/privacy}","received_events_url":"https://api.github.com/users/shoyer/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T18:12:52Z","updated_at":"2015-08-18T18:12:52Z","body":"Redundant \"both\" and \"symmetric\" arguments seems like a bad idea. I would\npick one and stick to it (probably \"both\").\n\nOn Tue, Aug 18, 2015 at 11:11 AM, Leif Johnson <notifications@github.com>\nwrote:\n\n> OK, I've made a number of updates to the patch that address the comments\n> above.\n>\n>    - limit_direction is limited to 'forward', 'backward', 'both', or\n>    'symmetric' ('both' and 'symmetric' do the same thing), but can be passed\n>    in any combination of uppercase/lowercase. raises ValueError if not one of\n>    these values\n>    - tests for case/validity of limit_direction kwarg, filling values\n>    backward to beginning of series, and different limit_direction cases\n>\n> In dealing with the case of filling a series backward to the beginning, I\n> had to muck around with the interpolate_1d function a good bit more than\n> before. This makes the diff quite ugly ... I'd be happier with it if I\n> could check in a separate PR first that does the code-rearranging part of\n> things. Any opinions on how to do that? Or is everyone comfortable with an\n> ugly change that is nonetheless pretty well tested?\n>\n> Thanks for everyone's feedback on this by the way!\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/pydata/pandas/pull/10691#issuecomment-132303159>.\n>\n"}}