Skip to content
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

Tweak test_nunique_approx #466

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dask_expr/_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def map_partitions(
DataFrame-like args (both dask and pandas) must have the same
number of partitions as ``self` or comprise a single partition.
Key-word arguments, Single-partition arguments, and general
python-object argments will be broadcasted to all partitions.
python-object arguments will be broadcasted to all partitions.
enforce_metadata : bool, default True
Whether to enforce at runtime that the structure of the DataFrame
produced by ``func`` actually matches the structure of ``meta``.
Expand Down
14 changes: 11 additions & 3 deletions dask_expr/tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1134,9 +1134,17 @@ def test_unknown_partitions_different_root():


@xfail_gpu("compute_hll_array doesn't work for cudf")
def test_nunique_approx(df):
result = df.nunique_approx().compute()
assert 99 < result < 101
def test_nunique_approx(df, pdf):
actual = df.nunique_approx().compute()
assert 99 < actual < 101

actual = df.y.nunique_approx().compute()
expect = pdf.y.nunique()
assert expect * 0.99 < actual < expect * 1.01

actual = df.set_index("y").index.nunique_approx().compute()
expect = pdf.set_index("y").index.nunique()
assert expect * 0.99 < actual < expect * 1.01


def test_memory_usage_per_partition(df):
Expand Down
Loading