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

TST: new test for subset of a MultiIndex dtype #29356

Merged
merged 4 commits into from
Nov 16, 2019

Conversation

ganevgv
Copy link
Contributor

@ganevgv ganevgv commented Nov 2, 2019

Tried unsuccessfully reproducing Issue #20757 on pandas: 0.23.0 and 0.26.0.dev0+734.g0de99558b.dirty. That's why I decided to keep the input data from Issue #20757 unchanged.

@simonjayhawkins simonjayhawkins added the Testing pandas testing functions or related to the test suite label Nov 2, 2019
False,
0,
0,
False,
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 make this a bit more programatic, rather than hardcoding these values, it would be easier to copy-paste

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback, @jreback! Reproduced the same behaviour with simpler input data.

columns = pd.MultiIndex.from_tuples(columns)
df = pd.DataFrame(data, columns=columns)

tm.assert_equal(df.dtypes.a.d.i, df.a.d.i.dtypes)
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 use

result=
expected=
tm.assert_frame_equal(result, equal)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback, @jreback! Currently using tm.assert_series_equal(result, expected).

@ganevgv ganevgv force-pushed the tests/subsets_multiindex_dtype branch from dff9cab to d71f8ac Compare November 6, 2019 16:29
@ganevgv ganevgv force-pushed the tests/subsets_multiindex_dtype branch from 66742a6 to 7ea396e Compare November 6, 2019 20:29
@ganevgv ganevgv requested a review from jreback November 10, 2019 15:19
@jreback jreback added this to the 1.0 milestone Nov 16, 2019
@jreback jreback merged commit 94412ee into pandas-dev:master Nov 16, 2019
@jreback
Copy link
Contributor

jreback commented Nov 16, 2019

thanks @ganevgv

Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MultiIndex Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selecting "subsets" of a MultiIndex DataFrame sometimes changes dtypes
3 participants