REGR: Better warning in pivot_table when dropping nuisance columns
State: closed

- [x] closes #49247 (Replace xxxx with the GitHub issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Warnings
description: Warnings that appear or should be added to pandas
name: Nuisance Columns
description: Identifying/Dropping nuisance columns in reductions, groupby.add, DataFrame.apply

Comments:
Agreed @phofl - users are currently getting FutureWarnings, so really no behavior change. The change in message is just a bit easier to understand.
Thanks @rhshadrach 
Oops, something went wrong applying the patch ... Please have a look at my logs.
@mroeschke - I can take care of the backport, but meeseeks usually has very explicit output for doing so - did this get moved to somewhere else?
its also not adding the manual backport label, something is off
Don't think this should have changed. I'll try retriggering the backport
@meeseeksdev backport 1.5.x
Oops, something went wrong applying the patch ... Please have a look at my logs.
@meeseeksdev say hi
hi
Thank you!
@meeseeksdev backport 1.5.x
Oops, something went wrong applying the patch ... Please have a look at my logs.
@meeseeksdev backport 1.5.x
Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
git checkout 1.5.x
git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
git cherry-pick -x -m1 ab89c53f48df67709a533b6a95ce3d911871a0a8
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
git commit -am 'Backport PR #49615: REGR: Better warning in pivot_table when dropping nuisance columns'
```

4. Push to a named branch:

```
git push YOURFORK 1.5.x:auto-backport-of-pr-49615-on-1.5.x
```

5. Create a PR against branch 1.5.x, I would have named this PR:

> "Backport PR #49615 on branch 1.5.x (REGR: Better warning in pivot_table when dropping nuisance columns)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the `Still Needs Manual Backport` label once the PR gets merged.

If these instructions are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
looks like this was already backported manually in #49653

removing the 'still needs manual backport' then
Ack - sorry for my bad bookkeeping @MarcoGorelli!