home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 456239824

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/2695#issuecomment-456239824 https://api.github.com/repos/pydata/xarray/issues/2695 456239824 MDEyOklzc3VlQ29tbWVudDQ1NjIzOTgyNA== 43613877 2019-01-22T01:25:55Z 2019-01-22T01:25:55Z CONTRIBUTOR

Thanks for the clarification! I think the tolerance argument might even be superior to the limit or to say the least, the resample methods would benefit from any of these arguments.

My above mentioned changes to the code, despite mixing up limit and tolerance, actually seem to implement the tolerance argument.

```python import xarray as xr import pandas as pd import datetime as dt

dates=[dt.datetime(2018,1,1), dt.datetime(2018,1,2)] data=[10,20] df=pd.DataFrame(data,index=dates) xdf = xr.Dataset.from_dataframe(df) xdf.resample({'index':'1H'}).nearest(tolerance=dt.timedelta(hours=2)) ``` would lead to

<xarray.Dataset> Dimensions: (index: 25) Coordinates: * index (index) datetime64[ns] 2018-01-01 ... 2018-01-02 Data variables: 0 (index) float64 10.0 10.0 10.0 nan nan ... nan nan 20.0 20.0 20.0

Would that be helpful to include and write a pull request?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  401392318
Powered by Datasette · Queries took 0.656ms · About: xarray-datasette