REGR: Resampler.aggregate fails when used with column selection
State: closed

- [x] closes #42905
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [x] whatsnew entry

The method `resample._GroupByMixin._gotitem` calls

```
new_rs = type(self)(
    subset, groupby=groupby, parent=self, selection=selection, **kwargs
)
```

The selection (which ends up in kwargs in `__init__`) was being ignored.


Labels:
name: Bug
name: Regression
description: Functionality that used to work in a prior pandas version
name: Resample
description: resample method

Comments:
Thanks @simonjayhawkins - comments addressed.
thanks @rhshadrach 
@meeseeksdev backport 1.3.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.3.x
$ git pull
```

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

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

```
$ git commit -am 'Backport PR #43410: REGR: Resampler.aggregate fails when used with column selection'
```

4. Push to a named branch :

```
git push YOURFORK 1.3.x:auto-backport-of-pr-43410-on-1.3.x
```

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

> "Backport PR #43410 on branch 1.3.x (REGR: Resampler.aggregate fails when used with column selection)"

And apply the correct labels and milestones.

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

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

If these instruction are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
@rhshadrach can you put up the manual backport :-<
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.3.x
$ git pull
```

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

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

```
$ git commit -am 'Backport PR #43410: REGR: Resampler.aggregate fails when used with column selection'
```

4. Push to a named branch :

```
git push YOURFORK 1.3.x:auto-backport-of-pr-43410-on-1.3.x
```

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

> "Backport PR #43410 on branch 1.3.x (REGR: Resampler.aggregate fails when used with column selection)"

And apply the correct labels and milestones.

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

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

If these instruction are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
@meeseeksdev backport 1.3.x