New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid pandas
constructors in dask.dataframe.core
#9570
Changes from 2 commits
a59af4a
5ec150d
91538c8
dfe1114
1ba0353
97ceffd
ee35931
8ad7e72
5c49d07
8b88469
4e8ed06
61ee8ab
a2613f5
ed3620f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3202,6 +3202,24 @@ def test_cov(): | |
assert res._name != res3._name | ||
|
||
|
||
@pytest.mark.gpu | ||
def test_cov_gpu(): | ||
Comment on lines
+3204
to
+3205
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the backend PR goes in before this PR, could we just reuse There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps. We would need to change the |
||
cudf = pytest.importorskip("cudf") | ||
|
||
# cudf DataFrame | ||
df = cudf.from_pandas(_compat.makeDataFrame()) | ||
ddf = dd.from_pandas(df, npartitions=6) | ||
|
||
res = ddf.cov() | ||
res2 = ddf.cov(split_every=2) | ||
sol = df.cov() | ||
# TODO: dtype of res.index is wrong before compute | ||
assert_eq(res.compute(), sol) | ||
assert_eq(res2.compute(), sol) | ||
assert res._name == ddf.cov()._name | ||
assert res._name != res2._name | ||
|
||
|
||
def test_corr(): | ||
# DataFrame | ||
df = _compat.makeMissingDataframe() | ||
|
@@ -3249,6 +3267,24 @@ def test_corr(): | |
pytest.raises(TypeError, lambda: da.corr(ddf)) | ||
|
||
|
||
@pytest.mark.gpu | ||
def test_corr_gpu(): | ||
Comment on lines
+3268
to
+3269
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar comment here |
||
cudf = pytest.importorskip("cudf") | ||
|
||
# cudf DataFrame | ||
df = cudf.from_pandas(_compat.makeDataFrame()) | ||
ddf = dd.from_pandas(df, npartitions=6) | ||
|
||
res = ddf.corr() | ||
res2 = ddf.corr(split_every=2) | ||
sol = df.corr() | ||
# TODO: dtype of res.index is wrong before compute | ||
assert_eq(res.compute(), sol) | ||
assert_eq(res2.compute(), sol) | ||
assert res._name == ddf.corr()._name | ||
assert res._name != res2._name | ||
|
||
|
||
def test_corr_same_name(): | ||
# Series with same names (see https://github.com/dask/dask/issues/4906) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is
data
here? Can we get the DataFrame type from that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data
islist[dict[str, np/cupy.ndarray]]
here. Therfore, we would need to extendserial_frame_constructor
to handle array-like data if we want to avoid thelike_df
argument.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1ba0353 adds a
serial_constructor_from_array
dispatch (but doesn't actually use it yet) to illustrate what it would probably look like.