MCPcopy Create free account
hub / github.com/dask/dask / test_corr

Function test_corr

dask/dataframe/tests/test_dataframe.py:3082–3126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3080
3081
3082def test_corr():
3083 # DataFrame
3084 df = _compat.makeMissingDataFrame()
3085 ddf = dd.from_pandas(df, npartitions=6)
3086
3087 res = ddf.corr()
3088 res2 = ddf.corr(split_every=2)
3089 res3 = ddf.corr(min_periods=10)
3090 res4 = ddf.corr(min_periods=10, split_every=2)
3091 sol = df.corr()
3092 sol2 = df.corr(min_periods=10)
3093 assert_eq(res, sol)
3094 assert_eq(res2, sol)
3095 assert_eq(res3, sol2)
3096 assert_eq(res4, sol2)
3097 assert res._name == ddf.corr()._name
3098 assert res._name != res2._name
3099 assert res3._name != res4._name
3100 assert res._name != res3._name
3101
3102 pytest.raises(NotImplementedError, lambda: ddf.corr(method="spearman"))
3103
3104 # Series
3105 a = df.A
3106 b = df.B
3107 da = dd.from_pandas(a, npartitions=6)
3108 db = dd.from_pandas(b, npartitions=6)
3109
3110 res = da.corr(db)
3111 res2 = da.corr(db, split_every=2)
3112 res3 = da.corr(db, min_periods=10)
3113 res4 = da.corr(db, min_periods=10, split_every=2)
3114 sol = da.corr(db)
3115 sol2 = da.corr(db, min_periods=10)
3116 assert_eq(res, sol)
3117 assert_eq(res2, sol)
3118 assert_eq(res3, sol2)
3119 assert_eq(res4, sol2)
3120 assert res._name == da.corr(db)._name
3121 assert res._name != res2._name
3122 assert res3._name != res4._name
3123 assert res._name != res3._name
3124
3125 pytest.raises(NotImplementedError, lambda: da.corr(db, method="spearman"))
3126 pytest.raises(TypeError, lambda: da.corr(ddf))
3127
3128
3129@pytest.mark.gpu

Callers

nothing calls this directly

Calls 2

assert_eqFunction · 0.90
corrMethod · 0.45

Tested by

no test coverage detected