BUG: Fix nansum overflow on Windows with bottleneck
State: closed

Bottleneck used in nansum produces overflow error on Windows. Temporary fix that could be undone once the error in bottleneck is fixed and released, to avoid platform specificity.

 - [x] closes #15453 
 - [x] tests added / passed
 - [x] passes ``git diff upstream/master | flake8 --diff``
 - [x] whatsnew entry

Labels:
name: Bug
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations
name: Windows
description: Windows OS

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15507?src=pr&el=h1) Report
> Merging [#15507](https://codecov.io/gh/pandas-dev/pandas/pull/15507?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/23889d3ec8396925269210d6d5782574e61769bd?src=pr&el=desc) will **decrease** coverage by `-0.07%`.
> The diff coverage is `100%`.


```diff
@@            Coverage Diff             @@
##           master   #15507      +/-   ##
==========================================
- Coverage    91.1%   91.03%   -0.07%     
==========================================
  Files         136      136              
  Lines       49102    49103       +1     
==========================================
- Hits        44736    44703      -33     
- Misses       4366     4400      +34
```


| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/15507?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/nanops.py](https://codecov.io/gh/pandas-dev/pandas/compare/23889d3ec8396925269210d6d5782574e61769bd...7b95a881c6de9367cbe5afa4e23bdfa9c6c6360b?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvbmFub3BzLnB5) | `97.96% <100%> (-0.21%)` | :x: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/compare/23889d3ec8396925269210d6d5782574e61769bd...7b95a881c6de9367cbe5afa4e23bdfa9c6c6360b?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `40% <0%> (-46.67%)` | :x: |
| [pandas/util/decorators.py](https://codecov.io/gh/pandas-dev/pandas/compare/23889d3ec8396925269210d6d5782574e61769bd...7b95a881c6de9367cbe5afa4e23bdfa9c6c6360b?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvZGVjb3JhdG9ycy5weQ==) | `67.92% <0%> (-1.31%)` | :x: |
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/compare/23889d3ec8396925269210d6d5782574e61769bd...7b95a881c6de9367cbe5afa4e23bdfa9c6c6360b?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `93.05% <0%> (-0.86%)` | :x: |
| [pandas/tools/merge.py](https://codecov.io/gh/pandas-dev/pandas/compare/23889d3ec8396925269210d6d5782574e61769bd...7b95a881c6de9367cbe5afa4e23bdfa9c6c6360b?src=pr&el=tree#diff-cGFuZGFzL3Rvb2xzL21lcmdlLnB5) | `91.78% <0%> (-0.35%)` | :x: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/compare/23889d3ec8396925269210d6d5782574e61769bd...7b95a881c6de9367cbe5afa4e23bdfa9c6c6360b?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.74% <0%> (-0.1%)` | :x: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/compare/23889d3ec8396925269210d6d5782574e61769bd...7b95a881c6de9367cbe5afa4e23bdfa9c6c6360b?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.93% <0%> (-0.04%)` | :x: |
| [pandas/core/algorithms.py](https://codecov.io/gh/pandas-dev/pandas/compare/23889d3ec8396925269210d6d5782574e61769bd...7b95a881c6de9367cbe5afa4e23bdfa9c6c6360b?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYWxnb3JpdGhtcy5weQ==) | `94.48% <0%> (ø)` | :white_check_mark: |
| [pandas/compat/pickle_compat.py](https://codecov.io/gh/pandas-dev/pandas/compare/23889d3ec8396925269210d6d5782574e61769bd...7b95a881c6de9367cbe5afa4e23bdfa9c6c6360b?src=pr&el=tree#diff-cGFuZGFzL2NvbXBhdC9waWNrbGVfY29tcGF0LnB5) | `68.29% <0%> (ø)` | :white_check_mark: |
| ... and [3 more](https://codecov.io/gh/pandas-dev/pandas/pull/15507?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15507?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/15507?src=pr&el=footer). Last update [23889d3...7b95a88](https://codecov.io/gh/pandas-dev/pandas/compare/23889d3ec8396925269210d6d5782574e61769bd...7b95a881c6de9367cbe5afa4e23bdfa9c6c6360b?src=pr&el=footer&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
@jorisvandenbossche @shoyer 

w.r.t. #9422 I think we need to simply change this (in effect what this PR does), but for all platforms (and not just windows).

@JaviSorribes Looking at @jreback's comments, it looks like we should just disable `nansum` bottleneck calls altogether.
So I understand @jreback and @cpcloud that we should not use bottleneck at all for nansum? Checkout the image attached for what I think this would look like.

Also, what about all the other nan operations? Should we consider possible overflow in any of them?

![image](https://cloud.githubusercontent.com/assets/15252789/23396198/3420769c-fd58-11e6-85bd-4c9001dd032d.png)
xref #15542 
We indeed just need to take a decision on #9422, as we have left this lingering too long. 
But, I am not necessarily convinced that we should change everything to the native pandas way (returning NaN), instead of changing pandas to return 0 to align with numpy/bottleneck (and also R, matlab, ..). 
I don't think there was really agreement on this in #9422 (several have argued for both positions), but I also don't know how to best proceed on taking a decision.
The fixes are related to fixing #9422 are a bit bigger in scope than this. That said If you want to rebase / add some additional tests could take this as a precurser.
closing this. as #9422 needs resolution.