dchvn opened a new pull request #34213:
URL: https://github.com/apache/spark/pull/34213
### What changes were proposed in this pull request?
Implement DataFrame.cov
### Why are the changes needed?
Increase pandas API coverage in PySpark
### Does this PR introduce _any_ user-facing change?
User can use
``` python
>>> psdf = ps.DataFrame([(1, 2), (0, 3), (2, 0), (1, 1)],
... columns=['dogs', 'cats'])
>>> psdf.cov()
dogs cats
dogs 0.666667 -1.000000
cats -1.000000 1.666667
>>> pdf = pd.DataFrame(
... {
... "a": [1, np.nan, 3, 4],
... "b": [True, False, False, True],
... "c": [True, True, False, True],
... }
... )
>>> psdf = ps.from_pandas(pdf)
>>> psdf.cov()
a b c
a 2.333333 -0.166667 -0.166667
b -0.166667 0.333333 0.166667
c -0.166667 0.166667 0.250000
```
### How was this patch tested?
unit tests
--
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]