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

COMPAT: Pandas 0.23 duplicate names in MI #3041

Merged
merged 2 commits into from Jan 2, 2018

Conversation

TomAugspurger
Copy link
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
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.

# https://github.com/pandas-dev/pandas/pull/18882
names = [None] * df.index.nlevels
result = df.drop_duplicates().rename_axis(names)
return result
Copy link
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
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.

None yet

2 participants