API: add DataFrame.nunique() and DataFrameGroupBy.nunique()
State: closed

- [x] closes #14336
- [x] tests added / passed
- [x] passes `git diff upstream/master | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Enhancement
name: Groupby

Comments:
## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14376?src=pr) is 84.77% (diff: 75.00%)
> Merging [#14376](https://codecov.io/gh/pandas-dev/pandas/pull/14376?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will decrease coverage by **<.01%**

```diff
@@             master     #14376   diff @@
==========================================
  Files           145        145          
  Lines         51090      51133    +43   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43315      43347    +32   
- Misses         7775       7786    +11   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [3e3434b...a0558e7](https://codecov.io/gh/pandas-dev/pandas/compare/3e3434b21e3c135c3bd7649689d488380ea1ebc1...a0558e7875ceb38b9897f0c878ef8f3cc746583e?src=pr)
these are not going to be very efficient. Pls add some benchmarks. 

I could not get the benchmarks to run with `asv` under win32, so now there is something basically following what is already there for `count()`.

There is no 'fast-path' in the implementation of `nunique()` for `describe(include='all')` either, right?

can you rebase and post some asv numbers
OK, rebased. None of the [proposed methods](http://pandas.pydata.org/pandas-docs/stable/contributing.html#running-the-performance-test-suite) to run `asv` on this seem to work on my win machine, e.g.:

```
(C:\Users\User\Miniconda2) C:\Users\User\Desktop\pandas\asv_bench>asv run 4c13e.
.9ab44 -b _nunique
· Creating environments
· Discovering benchmarks
·· Uninstalling from conda-py2.7-Cython-libpython-matplotlib-numexpr-numpy-openp
yxl-pytables-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt
·· Installing into conda-py2.7-Cython-libpython-matplotlib-numexpr-numpy-openpyx
l-pytables-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt
· Running 3 total benchmarks (1 commits * 1 environments * 3 benchmarks)
[  0.00%] · For pandas commit hash 9ab44eec:
[  0.00%] ·· Building for conda-py2.7-Cython-libpython-matplotlib-numexpr-numpy-
openpyxl-pytables-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt
[  0.00%] ··· Error running C:\Users\User\Desktop\pandas\asv_bench\env\eebfa40b3
935b6d282712e13c756274b\python.exe setup.py build
              STDOUT -------->
[...]
              build\temp.win-amd64-2.7\Release\pandas\src\datetime\np_datetime_s
trings.o:np_datetime_strings.c:(.text+0x12): undefined reference to `localtime_r
'
              collect2.exe: error: ld returned 1 exit status
              error: command 'C:\\Users\\User\\Miniconda2\\Scripts\\gcc.bat' fai
led with exit status 1

[  0.00%] ·· Skipping conda-py2.7-Cython-libpython-matplotlib-numexpr-numpy-open
pyxl-pytables-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt
[ 33.33%] ··· Benchmark groupby.groupby_nunique.time_groupby_nunique skipped
[ 66.67%] ··· Benchmark groupby.GroupBySuite.time_nunique skipped
[100.00%] ··· Benchmark frame_methods.frame_nunique.time_frame_nunique skipped
```
@xflr6 ok lgtm. just some added tests / docs. ping on green.

don't worry about the benchmarks.
Thanks, extended the docs and tests, CI passed.
@xflr6 As @jreback said, it is no problem that you do not get the benchmarks working for this PR. But, just to try to solve it: there seems to go something wrong in building the environment. Can you yourself build pandas master in a conda env?
lgtm. @jorisvandenbossche if you have any final comments.
thanks @xflr6 
One remaining remark is that I think row-wise / column-wise is a wrong explanation in this case.
@jorisvandenbossche I took that out on the merge, FYI