Repository: dask/dask

Issue:
Resample fails on different rules
<!-- Please include a self-contained copy-pastable example that generates the issue if possible.

Please be concise with code posted. See guidelines below on how to provide a good bug report:

- Craft Minimal Bug Reports http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
- Minimal Complete Verifiable Examples https://stackoverflow.com/help/mcve

Bug reports that follow these guidelines are easier to diagnose, and so are often handled much more quickly.
-->

**What happened**:
`resample` raises `NotImplementedError` error for rules that don't evenly divide a day.  

**What you expected to happen**:
Different frequency rules should be allowed for time series resampling. 

**Minimal Complete Verifiable Example**:

```python
p = 100
index = pd.date_range(start="2012-01-02", periods=p, freq="H")
df = pd.DataFrame({"p": np.random.random(p)}, index=index)
ddf = dd.from_pandas(df, npartitions=5)
result = ddf.resample("2D").count().compute()
--------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
~/workplaces/dask-env/dask/dask/dataframe/tseries/resample.py in __init__(self, obj, rule, **kwargs)
    132                 "Resampling frequency %s that does"
    133                 " not evenly divide a day is not "
--> 134                 "implemented" % rule
    135             )
    136         self._rule = rule

NotImplementedError: Resampling frequency <2 * Days> that does not evenly divide a day is not implemented
```

**Anything else we need to know?**:
I got a correct resampling for the example above after removing the check on:
https://github.com/dask/dask/blob/79836fe4a52c9cf0e1eb32525792ad6bfed1c62b/dask/dataframe/tseries/resample.py#L130

Also for test:
https://github.com/dask/dask/blob/79836fe4a52c9cf0e1eb32525792ad6bfed1c62b/dask/dataframe/tseries/tests/test_resample.py#L131

```python
expected = s.resample('57T').mean()
expected
```
```
2012-01-02 00:00:00    28
2012-01-02 00:57:00    78
Freq: 57T, dtype: int64
```

```python
ds = dd.from_pandas(s, npartitions=5)
result = ds.resample('57T').mean().compute()
result
```
```
2012-01-02 00:00:00    28
2012-01-02 00:57:00    78
Freq: 57T, dtype: int64
```
I can attempt a PR to remove raising this error, if my assumption here is correct. 

**Environment**:

- Dask version: 2.17.2
- Python version: 3.7.6
- Operating System: MacOS 10.15
- Install method (conda, pip, source): source



Discussion:

Resolving patch:
diff --git a/dask/dataframe/tseries/resample.py b/dask/dataframe/tseries/resample.py
--- a/dask/dataframe/tseries/resample.py
+++ b/dask/dataframe/tseries/resample.py
@@ -124,16 +124,7 @@ def __init__(self, obj, rule, **kwargs):
             )
             raise ValueError(msg)
         self.obj = obj
-        rule = pd.tseries.frequencies.to_offset(rule)
-        day_nanos = pd.tseries.frequencies.Day().nanos
-
-        if getnanos(rule) and day_nanos % rule.nanos:
-            raise NotImplementedError(
-                "Resampling frequency %s that does"
-                " not evenly divide a day is not "
-                "implemented" % rule
-            )
-        self._rule = rule
+        self._rule = pd.tseries.frequencies.to_offset(rule)
         self._kwargs = kwargs
 
     def _agg(self, how, meta=None, fill_value=np.nan, how_args=(), how_kwargs={}):


Test patch:
diff --git a/dask/dataframe/tseries/tests/test_resample.py b/dask/dataframe/tseries/tests/test_resample.py
--- a/dask/dataframe/tseries/tests/test_resample.py
+++ b/dask/dataframe/tseries/tests/test_resample.py
@@ -128,12 +128,32 @@ def test_resample_pads_last_division_to_avoid_off_by_one():
     assert_eq(actual, expected)
 
 
-def test_series_resample_not_implemented():
-    index = pd.date_range(start="2012-01-02", periods=100, freq="T")
+def test_resample_does_not_evenly_divide_day():
+    import numpy as np
+
+    index = pd.date_range("2012-01-02", "2012-02-02", freq="H")
+    index = index.union(pd.date_range("2012-03-02", "2012-04-02", freq="H"))
+    df = pd.DataFrame({"p": np.random.random(len(index))}, index=index)
+    ddf = dd.from_pandas(df, npartitions=5)
+    # Frequency doesn't evenly divide day
+    expected = df.resample("2D").count()
+    result = ddf.resample("2D").count().compute()
+
+    assert_eq(result, expected)
+
+
+def test_series_resample_does_not_evenly_divide_day():
+    index = pd.date_range("2012-01-02 00:00:00", "2012-01-02 01:00:00", freq="T")
+    index = index.union(
+        pd.date_range("2012-01-02 06:00:00", "2012-01-02 08:00:00", freq="T")
+    )
     s = pd.Series(range(len(index)), index=index)
     ds = dd.from_pandas(s, npartitions=5)
     # Frequency doesn't evenly divide day
-    pytest.raises(NotImplementedError, lambda: resample(ds, "57T"))
+    expected = s.resample("57T").mean()
+    result = ds.resample("57T").mean().compute()
+
+    assert_eq(result, expected)
 
 
 def test_unknown_divisions_error():