BUG: Rolling apply on DataFrame with Datetime index returns NaN
State: closed

 - [x]  #15305
 - [x] changing the order of 'calling roll_sum' and 'get_window_indexer' in 'roll_generic' could fix #15305 
The bug caused by the return values from get_window_indexer. It changes value of 'win', which is not supposed to be passed to roll_sum.




Labels:
name: Bug
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Resample
description: resample method

Comments:
> could fix #15305

You can write a test to confirm your suspicion :wink: 
Hello @FXocena! Thanks for updating the PR.



Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on August 09, 2017 at 11:21 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=h1) Report
> Merging [#17156](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/8e6b09ff3a09de58e82da6dcabbfddba61a743d6?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/17156/graphs/tree.svg?width=650&height=150&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17156      +/-   ##
==========================================
- Coverage   91.01%   90.99%   -0.03%     
==========================================
  Files         162      162              
  Lines       49497    49497              
==========================================
- Hits        45051    45041      -10     
- Misses       4446     4456      +10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.77% <ø> (-0.01%)` | :arrow_down: |
| #single | `40.26% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.66% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.23% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=footer). Last update [8e6b09f...0a7db15](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=h1) Report
> Merging [#17156](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/3e9e947b89d8edd7426bf8c748b1c6e3de5a7afb?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/17156/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&height=150&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17156      +/-   ##
==========================================
- Coverage   91.02%   91.01%   -0.02%     
==========================================
  Files         162      162              
  Lines       49511    49511              
==========================================
- Hits        45069    45061       -8     
- Misses       4442     4450       +8
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.79% <ø> (ø)` | :arrow_up: |
| #single | `40.26% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.71% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.03% <0%> (ø)` | :arrow_up: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.33% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=footer). Last update [3e9e947...8f165d7](https://codecov.io/gh/pandas-dev/pandas/pull/17156?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

@gfyoung I add a test method to class TestRolling in test_window. 
The method is called 'test_constructor_with_timedelta_window_and_minperiods', using same dataframe as 'test_constructor_with_timedelta_window'.
with old window.pyx, this test will fail since the result_roll_generic is a all-nan dataframe
This is my first pull request, I'm not sure is this what you want?
@FXocena : This looks pretty good.  You will need to address some style-checking errors <a href="https://travis-ci.org/pandas-dev/pandas/jobs/260999962#L1847">here</a> and add a `whatsnew` entry.  Otherwise, it looks great!
ok pushed a commit. this can be merged on green.
thanks!