DOC: Groupby transform should mention that parameter can be a string
State: closed

- [ ] closes https://github.com/pandas-dev/pandas/issues/49961
- [ ] [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
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `pandas/core/groupby/groupby.py`


Labels:
name: Docs
name: Groupby
name: Apply
description: Apply, Aggregate, Transform, Map

Comments:
@seanjedi - thanks for the PR! Can you shorten the title (there is an edit button above) - being concise is best here.
@seanjedi can you add examples also, 
For  dataframegroupby you can add
`
grouped.transform("sum")
`
with it's output and similarly for SeriesGroupBy.transform()
@ramvikrams  Responding to: https://github.com/pandas-dev/pandas/pull/50029#issuecomment-1336017459 
I believe that the docs for dataframegroupby and SeriesGroupBy transform utilizes the same location for their docs in the code, so it only requires the changes I made in that location to show up for both, as this is a template that get's used by those respective classes.
Would you want me to add what to expect for the output for this function in general? (I think it already does that?)
 Or for dataframegroupby  and SeriesGroupBy in particular?

Also, I have updated the code here for the example with `grouped.transform("sum")`
3b84281aea5673b2e3ba4624e2b7532895c2860a
> @ramvikrams  Responding to: https://github.com/pandas-dev/pandas/pull/50029#issuecomment-1336017459 
> I believe that the docs for dataframegroupby and SeriesGroupBy transform utilizes the same location for their docs in the code, so it only requires the changes I made in that location to show up for both, as this is a template that get's used by those respective classes.
> Would you want me to add what to expect for the output for this function in general? (I think it already does that?)
>  Or for dataframegroupby  and SeriesGroupBy in particular?
> 
> Also, I have updated the code here for the example with `grouped.transform("sum")`
> 3b84281aea5673b2e3ba4624e2b7532895c2860a

I think we have to change the  example also for Series it must be with pd.Series 
@ramvikrams is this better? 
b06287ea491939ead79f91ea881df8d141b4fd8e

In DataFrameGroupBy.transform it should be `pd.Dataframe = grouped.transform("sum")`
and in SeriesGroupBy.transform it should be `pd.Series = grouped.transform("sum")`
> @ramvikrams is this better? 
> b06287ea491939ead79f91ea881df8d141b4fd8e

I think changing the example for series and then rewriting it completely because right now it's with pd.dataframe
@ramvikrams Sorry, I had to update my comment, for https://github.com/pandas-dev/pandas/commit/b06287ea491939ead79f91ea881df8d141b4fd8e it should be updating the template, so that:
In DataFrameGroupBy.transform it should be `pd.Dataframe = grouped.transform("sum")`  
and in SeriesGroupBy.transform it should be `pd.Series = grouped.transform("sum")`

Since `%(klass)s` seems to be updated in the docs to what is using it, so in DataFrameGroupBy it gets updated to Dataframe, and SeriesGroupBy it gets changed to Series

So I am a bit confused since that is what you wanted correct? 
Or am I mistaking the request? 
Care to elaborate a little bit more, as I am a bit confused by the ask sorry. 
I am trying to say that this example 
```
df = pd.DataFrame({'A' : ['foo', 'bar', 'foo', 'bar',
                          'foo', 'bar'],
                   'B' : ['one', 'one', 'two', 'three',
                          'two', 'two'],
                   'C' : [1, 5, 5, 2, 5, 5],
                   'D' : [2.0, 5., 8., 1., 2., 9.]})
```
which is there in SeriesGroupBy.transform can you also change this it should be with pd.Series not dataframe, so can you rewrite this.
Ohh I see, I made an update here for that, hopefully, that fixes it, let me know where else I should do that change as well 
f6c24f71dd496abfcbd3d27319ef0b0a71b908db

I see some other dataframes in the doc (IE line 467 and 484), but it is specifically saying when using transform with dataframes, so I am unsure if I should change it

@seanjedi can you change this for the series example
```
ser = pd.Series(
        [390.0, 350.0, 30.0, 20.0],
        index=["Falcon", "Falcon", "Parrot", "Parrot"],
        name="Max Speed",
    )
```



@ramvikrams I think this should resolve the ask that you had: 207abd63cbc36c7fdc2024eaaebc76c1d5336168
Let me know if there is something else i should change
> @ramvikrams I think this should resolve the ask that you had: 207abd63cbc36c7fdc2024eaaebc76c1d5336168
> Let me know if there is something else i should change



Can you just add the example with string as parameter with its output also
@rhshadrach Any other changes I should make? 
Thanks @seanjedi 
@mroeschke Thanks for merging it, and also sorry for the late reply, I am in grad school and this is finals week so I have been a bit busy today. 
Glad I was able to contribute!