You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/04/07 19:50:12 UTC
[GitHub] [beam] TheNeuralBit commented on a change in pull request #14327: [BEAM-9547] DataFrame.corr cleanup
TheNeuralBit commented on a change in pull request #14327:
URL: https://github.com/apache/beam/pull/14327#discussion_r609017021
##########
File path: sdks/python/apache_beam/dataframe/frames_test.py
##########
@@ -526,13 +526,12 @@ def test_dataframe_cov_corr(self):
df = pd.DataFrame(np.random.randn(20, 3), columns=['a', 'b', 'c'])
df.loc[df.index[:5], 'a'] = np.nan
df.loc[df.index[5:10], 'b'] = np.nan
- self._run_test(lambda df: df.corr().round(8), df)
- self._run_test(lambda df: df.cov().round(8), df)
- self._run_test(lambda df: df.corr(min_periods=12).round(8), df)
- self._run_test(lambda df: df.cov(min_periods=12).round(8), df)
- self._run_test(lambda df: df.corrwith(df.a).round(8), df)
- self._run_test(
- lambda df: df[['a', 'b']].corrwith(df[['b', 'c']]).round(8), df)
+ self._run_test(lambda df: df.corr(), df)
+ self._run_test(lambda df: df.cov(), df)
+ self._run_test(lambda df: df.corr(min_periods=12), df)
+ self._run_test(lambda df: df.cov(min_periods=12), df)
+ self._run_test(lambda df: df.corrwith(df.a), df)
+ self._run_test(lambda df: df[['a', 'b']].corrwith(df[['b', 'c']]), df)
Review comment:
I'm not sure what you mean by that - do you mean I should add some more tests to verify this works correctly when columns are reordered? Something like:
```
df[['c', 'a', 'b']].corr()
```
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org