Uh oh!
There was an error while loading. Please reload this page.
ENH: resample methods with tolerance - #2716
Conversation
* ENH: resample methods bfill, pad, nearest accept tolerance keyword * DOC: documentation is updated with examples Fixes: GH2695
jhamman
commented
Jan 26, 2019
Thanks @observingClouds - At first glance, this seems right but we'll want some tests to confirm. You'll probably want to put these in test_missing.py. That's where the existing tests for bfill/pad/etc are so should be easy to extend for this feature. |
Sure @jhamman, I'll add some tests. Something like deftest_upsample_tolerance(self):
# Test tolerance keyword for upsample methods bfill, pad, nearesttimes=pd.date_range('2000-01-01', freq='1D', periods=2)
times_upsampled=pd.date_range('2000-01-01', freq='6H', periods=5)
array=DataArray(np.arange(2), [('time', times)])
# Forward fillactual=array.resample(time='6H').ffill(tolerance='12H')
expected=DataArray([0., 0., 0., np.nan, 1.],
[('time', times_upsampled)])
assert_identical(expected, actual) |
jhamman
commented
Jan 28, 2019
@observingClouds - I had forgotten the upsample tests were in |
Include tests for GH2695
Hello @observingClouds! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on January 30, 2019 at 22:33 Hours UTC |
shoyer
left a comment
There was a problem hiding this comment.
Two minor suggestions on the test, but other this looks good to me!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| and supports all of its schemes. All of these resampling operations work on both | ||
| Dataset and DataArray objects with an arbitrary number of dimensions. | ||
| In order to limit the scope of the methods ``ffill``, ``bfill``, ``pad`` and |
There was a problem hiding this comment.
Mention that "tolerance" is in coordinate (or label) units, not index units and that the index version is limit
There was a problem hiding this comment.
The unit for tolerance is now (a878ebc) explicitly mentioned in the time-series example. However, I did not comment on the index method as this has not been implemented for the resample method, yet. The index method seems to be a bigger/other project.
shoyer
commented
Jan 31, 2019
Thanks @observingClouds -- really nice PR! |
* master: remove xfail from test_cross_engine_read_write_netcdf4 (pydata#2741) Reenable cross engine read write netCDF test (pydata#2739) remove bottleneck dev build from travis, this test env was failing to build (pydata#2736) CFTimeIndex Resampling (pydata#2593) add tests for handling of empty pandas objects in constructors (pydata#2735) dropna() for a Series indexed by a CFTimeIndex (pydata#2734) deprecate compat & encoding (pydata#2703) Implement integrate (pydata#2653) ENH: resample methods with tolerance (pydata#2716) improve error message for invalid encoding (pydata#2730) silence a couple of warnings (pydata#2727)
whats-new.rstfor all changes andapi.rstfor new API