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: Adding test to concat where copy=False for ExtensionArrays #30625

Merged
merged 3 commits into from
Jan 4, 2020

Conversation

dwhu
Copy link
Contributor

@dwhu dwhu commented Jan 2, 2020

The test ensures that ExtensionArrays are correctly constructed when
concat(copy=False) is used.

The test ensures that ExtensionArrays are correctly constructed when
concat(copy=False) is used.
@@ -2730,3 +2730,25 @@ def test_concat_datetimeindex_freq():
expected = pd.DataFrame(data[50:] + data[:50], index=dr[50:].append(dr[:50]))
expected.index._data.freq = None
tm.assert_frame_equal(result, expected)


def test_concat_copy_false_extension_array():
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be add to the class at pandas.tests.extension.base.reshaping.BaseReshapingTests.

It'll need to be restructured a bit to not refer to decimal specifically. It needs to work with the data provided by the fixture. See the other concat there for examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SGTM. Moved the test to pandas.tests.extension.base.reshaping.BaseReshapingTests and updated the test to use the data provided by the fixture. I also simplified the test to make it more clear.

Also simplifying the test case to make it more understandable.
@TomAugspurger TomAugspurger added ExtensionArray Extending pandas with custom dtypes or arrays. Testing pandas testing functions or related to the test suite labels Jan 2, 2020
@TomAugspurger TomAugspurger added this to the 1.0 milestone Jan 2, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

lgtm, small change. ping on green.

@@ -94,6 +94,19 @@ def test_concat_columns(self, data, na_value):
result = pd.concat([df1["A"], df2["B"]], axis=1)
self.assert_frame_equal(result, expected)

# non-aligned
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 into a new test.

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

@dwhu dwhu requested a review from jreback January 3, 2020 17:41
@jreback jreback merged commit 9c730c1 into pandas-dev:master Jan 4, 2020
@jreback
Copy link
Contributor

jreback commented Jan 4, 2020

thanks @dwhu

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

Successfully merging this pull request may close these issues.

BUG: concat with copy=False of ExtensionArray fails
3 participants