Skip to content

Conversation

DRiXD
Copy link
Contributor

@DRiXD DRiXD commented Aug 23, 2023

I added a test to prevent the bug described in GG#50372 from happening again.

result = dg["x", 0]
tm.assert_series_equal(result, expected)

def test_tuple_string_column_names(self):
Copy link
Member

Choose a reason for hiding this comment

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

Can you move this to pandas/tests/indexing/multiindex/test_getitem.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @mroeschke


df_flat = df_flat[[("a", "aa"), "new_single_index"]]

assert df_flat.columns.equals(Index([("a", "aa"), "new_single_index"]))
Copy link
Member

Choose a reason for hiding this comment

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

Can you construct the full pandas object result of df_flat and use tm.assert_equal?

result = df_flat[[("a", "aa"), "new_single_index"]]
expected = ...
tm.assert_equal(result, expected)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also done (: @mroeschke

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Aug 23, 2023
@mroeschke mroeschke added this to the 2.2 milestone Aug 23, 2023
@mroeschke mroeschke merged commit 43a3f0e into pandas-dev:main Aug 23, 2023
@mroeschke
Copy link
Member

Thanks @DRiXD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Can't mix tuples and strings in column names with Numpy>=1.24
2 participants