Skip to content

TST: Add test to verify align behaviour on CategoricalIndex #34880

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

Merged
merged 4 commits into from
Jul 6, 2020
Merged

TST: Add test to verify align behaviour on CategoricalIndex #34880

merged 4 commits into from
Jul 6, 2020

Conversation

MBrouns
Copy link
Contributor

@MBrouns MBrouns commented Jun 20, 2020

verify that aligning two dataframes with a CategoricalIndex does not change the type of the index.

@charlesdong1991 charlesdong1991 added the Testing pandas testing functions or related to the test suite label Jun 20, 2020
@jorisvandenbossche jorisvandenbossche changed the title Add test to verify align behaviour on CategoricalIndex TST: Add test to verify align behaviour on CategoricalIndex Jun 20, 2020
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

There is a specific tests/frame/methods/test_align.py, so we can maybe rather put it there

@jreback jreback added the Categorical Categorical Data Type label Jun 20, 2020
@MBrouns
Copy link
Contributor Author

MBrouns commented Jun 26, 2020

@jorisvandenbossche anything that still needs to happen here?

@@ -129,6 +129,26 @@ def test_align_mixed_int(self, mixed_int_frame):
)
tm.assert_index_equal(bf.index, Index([]))

def test_align_categorical(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

can you rename this to test_align_categorical_unordered and then add an ordered version (alt is to parameterize this)

Copy link
Contributor Author

@MBrouns MBrouns Jun 26, 2020

Choose a reason for hiding this comment

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

I guess the same holds as previous, if one categorical is ordered and the other isn't, the expected dtype is object? If not, let me know so I can adjust the test

@pep8speaks
Copy link

pep8speaks commented Jun 26, 2020

Hello @MBrouns! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-07-06 14:58:43 UTC

@TomAugspurger
Copy link
Contributor

@MBrouns can you merge master & push? Will hopefully fix the CI issue.

@jreback jreback added this to the 1.1 milestone Jul 6, 2020
@jreback jreback added the Indexing Related to indexing on series/frames, not to indexes themselves label Jul 6, 2020
@jreback jreback merged commit 78de4ce into pandas-dev:master Jul 6, 2020
@jreback
Copy link
Contributor

jreback commented Jul 6, 2020

thanks @MBrouns very nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Indexing Related to indexing on series/frames, not to indexes themselves Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alignment of CategoricalIndex will convert the index to int type?
6 participants