ENH: Min_weight for Rolling
State: closed

Initial implementation for https://github.com/pydata/pandas/issues/11167.

Needs some additional tests - for dataframes, other axis values etc, but want to get this out there and get feedback.

Note that the implemenation is different than that for `min_periods`. This uses a single function to mask all rolling calculations. `min_periods` is implemented separately for each function. I imagine the latter is a bit faster, although also more complicated.
- [x] closes #11167
- [x] tests added / passed
- [x] passes `git diff upstream/master | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations

Comments:
is this in concert with `min_periods`? (e.g. looks like this), or better as either/or?

While you could use them together, most cases are going to be an either / or.

If it's _just_ either / or, we could implement within `min_periods` - a value < 1 going to `min_weight` and otherwise going to `min_periods`. But I think less explicit.

`min_periods=None` is the default, just wondering if it makes any sense to do it and/or raise if BOTH `min_weight` is not `None` and `min_periods`. You don't need to have special values.

Furthermore does the _order_ of application of `min_periods` and `min_weight` matter? 

give this some tests, if its too complicated / not worth it, ok w/o supporting both simultaneously

> wondering if it makes any sense to do it and/or raise if BOTH min_weight is not None and min_periods.

I think it's fine to have both - it will put a `NaN` in if either test fails. They are independent, so order doesn't matter.

> give this some tests, if its too complicated / not worth it, ok w/o supporting both simultaneously

My thought exactly

- update the doc-strings (Window/Rolling/Expanding/EWM), with versionadded tags.
- whatsnew sub-section to show mini-example and point to updated docs
- add to docs 
- more tests. Test for some edge cases (empty, 1 point, all-nan)

Yes will do - this was WIP. Thanks for the comments

can you rebase / update

## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/12750?src=pr) is 84.65% (diff: 100%)
> Merging [#12750](https://codecov.io/gh/pandas-dev/pandas/pull/12750?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will increase coverage by **<.01%**

```diff
@@             master     #12750   diff @@
==========================================
  Files           144        144          
  Lines         51025      51038    +13   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43191      43205    +14   
+ Misses         7834       7833     -1   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [4c3d4d4...3c42153](https://codecov.io/gh/pandas-dev/pandas/compare/4c3d4d4fbb5e1093a324d81dfd9de5d7650012c6...3c421538df97d7d28fa1ba6875f701a38ebba405?src=pr)
I've been remiss about the final fixes here. Will need a couple of weeks on other commitments but I will get to this

can you rebase / update?

if you can update

Yes, apologies, this is another I'll attempt over / after Thanksgiving. Appreciate the patience!

looks like you rebased, great.

needs some docs (computation.rst), whatsnew (you can do a sub-section or just put a ref to the docs) & doc-string examples.
status?
can you update
Yes, thanks for your patience. I'll wrap most of these up over the next month
@MaximilianR can you rebase / update
Forgive the extreme delay for this + a couple others. I need a few more weeks on other stuff, and then I'll give a push to finishing these up. 
pls rebase / update.
love the idea, but needs rebase and updating.