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

Sorting by a categorical column doesn't always work #11090

Closed
rjzamora opened this issue May 2, 2024 · 0 comments · Fixed by dask/dask-expr#1058
Closed

Sorting by a categorical column doesn't always work #11090

rjzamora opened this issue May 2, 2024 · 0 comments · Fixed by dask/dask-expr#1058
Labels
bug Something is broken dataframe

Comments

@rjzamora
Copy link
Member

rjzamora commented May 2, 2024

While debugging a dask-expr + cudf issue, I discovered that sort_values does not always work when by is a categorical column (regardless of whether query-planning is enabled).

Reproducer:

import numpy as np
import pandas as pd
import dask.dataframe as dd

df = pd.DataFrame()
df["a"] = np.arange(10)[::-1]
df["b"] = df["a"].astype("category")
ddf = dd.from_pandas(df, npartitions=2)
got = ddf.sort_values(by="b")
expect = df.sort_values(by="b")
dd.assert_eq(got, expect, check_index=False)

As far as I can tell, problem is that in places like this or this. It seems that we cannot always call min on a categorical series.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken dataframe
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant