BUG: pivot_table strings as aggfunc
State: closed

- [x] closes #18713
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry



Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Compat
description: pandas objects compatability with Numpy or Python functions

Comments:
Hello @bobhaffner! Thanks for updating the PR.





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on December 23, 2017 at 20:43 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18810?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@507157d`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18810/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/18810?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##             master   #18810   +/-   ##
=========================================
  Coverage          ?   91.65%           
=========================================
  Files             ?      154           
  Lines             ?    51368           
  Branches          ?        0           
=========================================
  Hits              ?    47080           
  Misses            ?     4288           
  Partials          ?        0
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.52% <100%> (?)` | |
| #single | `40.84% <0%> (?)` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18810?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/reshape/pivot.py](https://codecov.io/gh/pandas-dev/pandas/pull/18810/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9waXZvdC5weQ==) | `96.35% <100%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18810?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/18810?src=pr&el=footer). Last update [507157d...e24d232](https://codecov.io/gh/pandas-dev/pandas/pull/18810?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Thanks for the feedback @gfyoung.  
`test_pivot_string_as_func` is an attempt at @gfyoung's suggestion regarding comparing to a frame created from `DataFrame()` 

`test_pivot_string_func_vs_func` is an attempt at @jreback's suggestion of using `@pytest.mark.parametrize` to compare string_funcs to numpy funcs

Separating the cases into two functions seemed like the right thing to do.  As opposed to one rather long one with multiple `DataFrame` statements
> Separating the cases into two functions seemed like the right thing to do. As opposed to one rather long one with multiple DataFrame statements.

Seems reasonable to me.
Just following up on this to make sure no other changes are required.  No worries if folks are busy
Very interesting.  Looks like the rebase handled the whatsnew change quite nicely

```
(pandas-dev) Bobs-MacBook-Pro:pandas-dev bob$ git rebase upstream/master
First, rewinding head to replay your work on top of it...
Applying: pivot_table strings as aggfunc
Using index info to reconstruct a base tree...
A	doc/source/whatsnew/v0.22.0.txt
.git/rebase-apply/patch:11: trailing whitespace.
- 
warning: 1 line adds whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging doc/source/whatsnew/v0.23.0
Applying: fixed pep8 issues
Applying: fixed whatsnew
Using index info to reconstruct a base tree...
A	doc/source/whatsnew/v0.22.0.txt
Falling back to patching base and 3-way merge...
Auto-merging doc/source/whatsnew/v0.23.0
Applying: updated tests
Applying: added comments to test funcs
Applying: removed list usage in test parametrize
```
@bobhaffner : This is `git` - you should expect great things from it :smile: (unless you're pushing large files OR operating at big-tech-company-scale... :0 )
@gfyoung Haha, gotcha  :-)
lgtm. ping on green.
> lgtm. ping on green.

@jreback is this intended for me or some kind of shorthand for a notification process?   At any rate, ping   :-)    

Looks like there's a conflict with the whatsnew piece being changed back to the old name.  I can follow suit or wait till this is sorted out.      
thanks @bobhaffner 

yes 'ping on green' is a notification of you to ping me when this has passed and all buttons are green.
Thanks @jreback and @gfyoung!!!