Skip to content

Fix upstream to include bool type for Index - #8732

Merged
jsignell merged 8 commits into
dask:mainfrom
ncclementi:fix-upstream
Feb 22, 2022
Merged

jsignell merged 8 commits into
dask:mainfrom
ncclementi:fix-upstream

Conversation

@ncclementi

Copy link
Copy Markdown
Member

There was pandas bug enhancement (pandas-dev/pandas#45061), that includes the possibility of a boolean Index.

In dask operations that involve / or truediv (see comment #8722 (comment)) returns a dataframe with an object-dtyped index instead.

This PR includes includes the idx.dtype when registering the meta for the case of pd.Index

@github-actions github-actions Bot added dataframe dispatch Related to `Dispatch` extension objects labels Feb 17, 2022
@ncclementi

ncclementi commented Feb 17, 2022 •

Copy link
Copy Markdown
Member Author

It looks like the fix affected another set of tests.

  1. test_dataframe_aggregations_multilevel the cases that involve mean which makes sense as mean involves a / operation. See https://github.com/dask/dask/runs/5233914770?check_suite_focus=true#step:5:10818 . I noticed that the problem is that this line can't be executed.
    call(ddf["c"].groupby(grouper(ddf)), agg_func, split_every=2),

Not sure how to approach this error

  1. We are getting previous XFAIL tests that now are XPASS (causing a failure), for some cases of test_groupby_meta_content it looks like due to the addition of including bool index, the dtypes now coincide as boolean. Would removing these lines be the right approach?
    marks=pytest.mark.xfail(
    reason="index dtype does not coincide: boolean != empty"

EDIT: After a chat with @jrbourbeau and @phobson we got to the root of the problem, just pushed those changes which are fixing upstream. The remaining fails are unrelated.
But it seems we have a failure on ubuntu 3.9 https://github.com/dask/dask/runs/5238919474?check_suite_focus=true#step:6:21639

EDIT 2: re-run CI and the failure on ubuntu is not there anymore.

@jrbourbeau jrbourbeau changed the title Fix upstream to include bool type for Index. Fix upstream to include bool type for Index Feb 17, 2022
@jsignell

Copy link
Copy Markdown
Member

I took a look at the git blame and that "boolean != empty" goes back to #1692 I would not be surprised if that needed to change. I can't quite tell what it was trying to get at, but fundamentally the dtype of the index should not depend on the length of the index.

@ncclementi

Copy link
Copy Markdown
Member Author

This looks green! The only tests failing on the upstream build are being taken care of in #8558

@jsignell for the "boolean !=empty" message we ended telling it to NOT XFAIL when having pandas >=1.5. Unless you think there is something else that should be taken care of regarding that choice, I think this one is ready for a final review.

Comment thread dask/dataframe/backends.py Resolved
Co-authored-by: Julia Signell <[email protected]>
@jsignell
jsignell merged commit 9558ba1 into dask:main Feb 22, 2022
@jsignell

Copy link
Copy Markdown
Member

Thanks @ncclementi! This is in.

@ncclementi
ncclementi deleted the fix-upstream branch July 5, 2022 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dataframe dispatch Related to `Dispatch` extension objects upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[upstream/build] Groupby mean result index doesn't preserve bool dtype

2 participants