Implement DataFrame.value_counts
closes #5377

(This is a feature request stated in the form of a PR.)

This change makes it easy to count the number of times each unique row appears in a data frame. It also removes an unnecessary difference between DataFrame and Series (i.e. the existence of the `value_counts` methods).

```
        >>> df = pd.DataFrame({'num_legs': [2, 4, 4], 'num_wings': [2, 0, 0]},
        ...                   index=['falcon', 'dog', 'cat'])
        >>> df
                num_legs  num_wings
        falcon         2          2
        dog            4          0
        cat            4          0

        >>> df.value_counts()
        (4, 0)    2
        (2, 2)    1
        dtype: int64

        >>> df1col = df[['num_legs']]
        >>> df1col
                num_legs
        falcon         2
        dog            4
        cat            4

         >>> df1col.value_counts()
        (4,)    2
        (2,)    1
        dtype: int64
```

- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

A reasonable alternative may be `df.groupby(df.columns.tolist(),as_index=False).size()` as used here: https://stackoverflow.com/questions/35584085/how-to-count-duplicate-rows-in-pandas-dataframe

Mostly I just want there to be a simple way to count the rows by value. I think this would close #5377  Are the test failures actually related to the change I'm making? They seem to be in unrelated places. Yea looks like you need to run `black` on your changes I ran black. It appears to have improved the situation, but the remaining failures are still hidden away amongst tens of thousands of line of console output in travis-ci. Failure is at https://travis-ci.org/pandas-dev/pandas/jobs/559227356#L2861,
which doesn't look related. Maybe try merging master and pushing again.

On Tue, Jul 16, 2019 at 10:04 AM Craig Gidney <notifications@github.com>
wrote:

> I ran black. It appears to have improved the situation, but the remaining
> failures are still hidden away amongst tens of thousands of line of console
> output in travis-ci.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/27350?email_source=notifications&email_token=AAKAOIXOKXMDHJNN7SKNEETP7XPO5A5CNFSM4IBXSGW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BE2QY#issuecomment-511855939>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAKAOISJHYI46746RZ3MXKLP7XPO5ANCNFSM4IBXSGWQ>
> .
>
 Merging to master didn't fix it Ah, Dask uses duck-typing to check whether an object is Dataframe like:
https://github.com/dask/dask/blob/4b2dbd4469423cf313ec4e9fc6967b606493a3b1/dask/utils.py#L1073

One of the checks is the lack of a DataFrame.value_counts. Do you have any
interest in opening an issue on the Dask tracker to find an alternative
implementation? You can skip the
test here for Dask <= 2.1.0 (the current version of dask).

On Tue, Jul 16, 2019 at 8:54 PM Craig Gidney <notifications@github.com>
wrote:

> Merging to master didn't fix it
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/27350?email_source=notifications&email_token=AAKAOIWFIB5FUDSQO5N6W3LP7Z3WJA5CNFSM4IBXSGW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2CY4QY#issuecomment-512069187>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAKAOITDS6YSWECS2EUIXX3P7Z3WJANCNFSM4IBXSGWQ>
> .
>
 I opened https://github.com/dask/dask/issues/5109 on the dask repo This is passing now that Dask has been updated. Added a whatsnew I think it's now been five cycles of doing what was asked only to be asked for more or for something different. Please state *exactly* what you want *in full detail* if you want me to continue putting effort into this PR. Are there any more arguments you're going to need? Test cases? State them. @Strilanc we're defining a new API here, that can take some time as we think through all the design choices. @TomAugspurger I understand. I'm asking you to the thinking before I do the work. @Strilanc we of course try to be cognizant of contributor time but reviews are an iterative process. 

Are you still interested in working this? If so can you fix merge conflict? Closing as stale but @Strilanc ping if you'd like to pick back up