-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Bug in Series constructor returning wrong missing values #43026
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 1 commit
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 |
---|---|---|
|
@@ -356,6 +356,13 @@ def test_astype_bytes(self): | |
result = Series(["foo", "bar", "baz"]).astype(bytes) | ||
assert result.dtypes == np.dtype("S3") | ||
|
||
def test_astype_nan_to_bool(self): | ||
# GH#43018 | ||
ser = Series(np.nan, dtype="object") | ||
result = ser.astype("bool") | ||
expected = Series(True, dtype="bool") | ||
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. this is True? 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.
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. Yes exactly. |
||
tm.assert_series_equal(result, expected) | ||
|
||
|
||
class TestAstypeString: | ||
@pytest.mark.parametrize( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1776,6 +1776,18 @@ def test_constructor_with_pandas_dtype(self): | |
ser2 = Series(vals, dtype=dtype) | ||
tm.assert_series_equal(ser, ser2) | ||
|
||
def test_constructor_int_dtype_missing_values(self): | ||
# GH#43017 | ||
result = Series(index=[0], dtype="int64") | ||
expected = Series(np.nan, index=[0], dtype="float64") | ||
tm.assert_series_equal(result, expected) | ||
|
||
def test_constructor_bool_dtype_missing_values(self): | ||
# GH#43018 | ||
result = Series(index=[0], dtype="bool") | ||
expected = Series(True, index=[0], dtype="bool") | ||
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. this is True? |
||
tm.assert_series_equal(result, expected) | ||
|
||
|
||
class TestSeriesConstructorIndexCoercion: | ||
def test_series_constructor_datetimelike_index_coercion(self): | ||
|
Uh oh!
There was an error while loading. Please reload this page.