zhengruifeng opened a new pull request, #36660:
URL: https://github.com/apache/spark/pull/36660
### What changes were proposed in this pull request?
Implement Groupby.mad
### Why are the changes needed?
to increase pandas api coverage
### Does this PR introduce _any_ user-facing change?
yes
```
In [6]: pdf = pd.DataFrame({"A": [1, 2, 2, 1, 1], "B": [3, 2, 3, 9, 0], "C":
[3, 4, 13, -14, 9]})
In [7]: psdf = ps.from_pandas(pdf)
In [8]: pdf.groupby("A")[["B", "C"]].mad()
Out[8]:
B C
A
1 3.333333 8.888889
2 0.500000 4.500000
In [9]: psdf.groupby("A")[["B", "C"]].mad()
Out[9]:
B C
A
1 3.333333 8.888889
2 0.500000 4.500000
In [10]: pdf.B.groupby(pdf.A).mad()
Out[10]:
A
1 3.333333
2 0.500000
Name: B, dtype: float64
In [11]: psdf.B.groupby(psdf.A).mad()
Out[11]:
A
1 3.333333
2 0.500000
Name: B, dtype: float64
```
### How was this patch tested?
added ut
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]