-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: IntegerArray/FloatingArray constructors mismatched NAs #44514
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
Changes from 10 commits
ac09146
1166725
21b6977
742d321
020c4e2
a4d89ce
d322af3
67d615d
6350d8e
117aef7
0f17b88
2a2f8d2
4be676d
9cd5047
0d77cea
48a4531
745d24f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
from pandas.core.dtypes.dtypes import ( | ||
DatetimeTZDtype, | ||
IntervalDtype, | ||
PandasDtype, | ||
PeriodDtype, | ||
) | ||
|
||
import pandas as pd | ||
import pandas._testing as tm | ||
from pandas.tests.extension.base.base import BaseExtensionTests | ||
|
@@ -357,6 +364,31 @@ def test_setitem_series(self, data, full_indexer): | |
) | ||
self.assert_series_equal(result, expected) | ||
|
||
def test_setitem_frame_2d_values(self, data, using_array_manager, request): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you move this test out of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure |
||
# GH#44514 | ||
if using_array_manager: | ||
if not isinstance( | ||
data.dtype, (PandasDtype, PeriodDtype, IntervalDtype, DatetimeTZDtype) | ||
): | ||
# These dtypes have non-broken implementations of _can_hold_element | ||
mark = pytest.mark.xfail(reason="Goes through split path, loses dtype") | ||
request.node.add_marker(mark) | ||
|
||
df = pd.DataFrame({"A": data}) | ||
orig = df.copy() | ||
|
||
df.iloc[:] = df | ||
self.assert_frame_equal(df, orig) | ||
|
||
df.iloc[:-1] = df.iloc[:-1] | ||
self.assert_frame_equal(df, orig) | ||
|
||
df.iloc[:] = df.values | ||
self.assert_frame_equal(df, orig) | ||
|
||
df.iloc[:-1] = df.values[:-1] | ||
self.assert_frame_equal(df, orig) | ||
|
||
def test_delitem_series(self, data): | ||
# GH#40763 | ||
ser = pd.Series(data, name="data") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, could it be
libmissing.is_numeric_na
that already raises on encountering a "non-numeric NA"? (is there a use case for is_numeric_na to not be strict about this, i.e. to get a "partial" mask?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were you planning to address this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
planning to address in a follow-up