Skip to content

COMPAT: Pandas 0.23 duplicate names in MI - #3041

Merged
TomAugspurger merged 2 commits into
dask:masterfrom
TomAugspurger:duplicate-mi
Jan 2, 2018
Merged

TomAugspurger merged 2 commits into
dask:masterfrom
TomAugspurger:duplicate-mi

Conversation

@TomAugspurger

Copy link
Copy Markdown
Member

Pandas 0.23 is disallowing duplicate names in MultiIndexes. This
adjusts a test that relied on that behavior, and groupby().nunique which
produced it as a by-product.

Closes #3039

xref pandas-dev/pandas#18882

  • Tests added / passed
  • Passes flake8 dask
  • Fully documented, including docs/source/changelog.rst for all changes
    and one of the docs/source/*-api.rst files for new API

Pandas 0.23 is disallowing duplicate names in MultiIndexes. This
adjusts a test that relied on that behavior, and `groupby().nunique` which
produced it as a by-product.

Closes dask#3039

xref pandas-dev/pandas#18882
@TomAugspurger

Copy link
Copy Markdown
Member Author

All the tests have passed.

Pandas is considering turning this into a warning for 0.23 pandas-dev/pandas#19029, but we'll want to update anyway.

cc @jcrist if you have a chance to look over this.

Comment thread dask/dataframe/groupby.py Outdated
# https://github.com/pandas-dev/pandas/pull/18882
names = [None] * df.index.nlevels
result = df.drop_duplicates().rename_axis(names)
return result

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: just return instead of assign -> return. Also, rename_axis copies the data by default, when I don't think we need to here.

return df.drop_duplicates().rename_axis(names, copy=False)

@TomAugspurger

Copy link
Copy Markdown
Member Author

All green, merging since this is blocking master.

@TomAugspurger
TomAugspurger merged commit 98d85bc into dask:master Jan 2, 2018
@TomAugspurger
TomAugspurger deleted the duplicate-mi branch January 2, 2018 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants