Repository: pandas-dev/pandas
Pull request: BUG: invalid rolling window on empty input
Added a raise Value Error for the case when window==0, Kindly refer to issue #21286 for the same

- [x] closes #21286 
- [x] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] A simple except cases added


Problem statement:
rolling on 0 window causes core dump


pd.__version__ == 0.22.0

```python
import pandas as pd
series = pd.Series(range(1000))
series.rolling(0).min()
```
#### Problem description

Attempting to perform an operation on a series.rolling with window=0 

kills the kernel if running with jupyter. 

causes a core dump if running directly from python.  


 free(): invalid next size (fast): 0x00007fffbfcc5040 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x70bfb)[0x7fe14e0b0bfb]
/lib/x86_64-linux-gnu/libc.so.6(+0x76fc6)[0x7fe14e0b6fc6]
...




#### Expected Output
Should raise a ValueError instead of crashing.

Hints from issue discussion:
Thanks for the report, yep should raise!

Commit message: Update window.py

Added one more check for the windows == 0 problem

Patch to review:
diff --git a/pandas/core/window.py b/pandas/core/window.py
index 015e7f7913ed0..ed49ba1356fd9 100644
--- a/pandas/core/window.py
+++ b/pandas/core/window.py
@@ -96,6 +96,8 @@ def is_freq_type(self):
         return self.win_type == 'freq'
 
     def validate(self):
+        if self.window == 0:
+            raise ValueError("Please Enter a window other than 0")
         if self.center is not None and not is_bool(self.center):
             raise ValueError("center must be a boolean")
         if self.min_periods is not None and not \
@@ -602,6 +604,8 @@ def validate(self):
         if isinstance(window, (list, tuple, np.ndarray)):
             pass
         elif is_integer(window):
+            if window == 0:
+                raise ValueError("window must not be zero")
             if window < 0:
                 raise ValueError("window must be non-negative")
             try:


Code review comments:
diff_hunk: @@ -602,6 +604,8 @@ def validate(self):
         if isinstance(window, (list, tuple, np.ndarray)):
             pass
         elif is_integer(window):
+            if window == 0:
path: pandas/core/window.py
text: @user1:
Instead, you can combine this check with the one below (i.e `window <= 0`) and then raise an appropriate error message