Skip to content

TST: Match pandas warnings for concat sort#3897

Merged
TomAugspurger merged 3 commits intodask:masterfrom
TomAugspurger:concat-warnings
Aug 27, 2018
Merged

TST: Match pandas warnings for concat sort#3897
TomAugspurger merged 3 commits intodask:masterfrom
TomAugspurger:concat-warnings

Conversation

@TomAugspurger
Copy link
Copy Markdown
Member

Pandas now warns on concat / append when the non-expanding axis isn't already aligned. This PR should make us mostly align with pandas behavior (we may emit two warnings when pandas emits one in some cases, but fixing that would be a hassle).

The warnings occur when the graph is constructed, not at runtime.


result = concat_indexed_dataframes([a, b], join=join)
expected = pd.concat([A, B], axis=0, join=join)
with warnings.catch_warnings(record=True) as w:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The hope is that these tests are future-proof when pandas switches the default to sort=False. Then pandas should no longer emit warnings, but the tests will still pass (and we'll be free to clean this up).

pd.concat([pdf1, pdf2, pdf3]))


@pytest.mark.filterwarnings('ignore')
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was getting tedious, and I'm hoping the warning behavior is thoroughly tested by now.

@TomAugspurger
Copy link
Copy Markdown
Member Author

I have one more fix for compat with pandas master.

Avoid using a private method removed on pandas master.
@TomAugspurger
Copy link
Copy Markdown
Member Author

Latest commit fixes errors failing our cron build against pandas master like https://travis-ci.org/dask/dask/jobs/417927666#L1652

@TomAugspurger
Copy link
Copy Markdown
Member Author

Taking a look at the remaining failures now.

@TomAugspurger
Copy link
Copy Markdown
Member Author

Lasts failure should be due to pandas-dev/pandas#22465. Haven't figured out if that's a pandas bug or API change yet.

@TomAugspurger
Copy link
Copy Markdown
Member Author

@mrocklin if you're planning to release soon, it'd be nice to get this in for the compatibility fix.

I wouldn't recommend delaying the release for the resolution of pandas-dev/pandas#22465

@mrocklin
Copy link
Copy Markdown
Member

Noted. Happy to wait.

@TomAugspurger
Copy link
Copy Markdown
Member Author

Seems like that last issue will be fixed upstream in pandas. This should be good to go.

@TomAugspurger TomAugspurger merged commit 5038719 into dask:master Aug 27, 2018
@TomAugspurger TomAugspurger deleted the concat-warnings branch August 27, 2018 21:53
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