-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
BUG: Fix (22477) dtype=str converts NaN to 'n' #22564
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
f069fc2
062786f
a522d7f
c8667dd
4717e36
bdad724
7691c82
00a7ed8
e9a290d
aa6b4a9
ee854d7
64f6e1c
fdad0c5
31021b6
9711d35
086d2b5
27701e0
265f92d
0692db0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
parametrize tests and use iloc to check value
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,22 +137,19 @@ def test_constructor_no_data_index_order(self): | |
def test_constructor_no_data_string_type(self): | ||
# GH 22477 | ||
result = pd.Series(index=[1], dtype=str) | ||
assert result.isna().all() | ||
assert np.isnan(result.iloc[0]) | ||
|
||
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. check the value using iloc instead here which returns a scalar |
||
def test_constructor_single_element_string_type(self): | ||
@pytest.mark.parametrize('item', ['13']) | ||
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. you don't need to parameterize this test (only 1 case), and you need to change the name as the next test overwrites it. |
||
def test_constructor_single_element_string_type(self, item): | ||
# GH 22477 | ||
result = pd.Series(13, index=[1], dtype=str) | ||
assert result.values.tolist() == ['13'] | ||
result = pd.Series(int(item), index=[1], dtype=str) | ||
assert result.iloc[0] == item | ||
|
||
def test_constructor_string_element_string_type(self): | ||
@pytest.mark.parametrize('item', ['entry', 'ѐ']) | ||
def test_constructor_string_element_string_type(self, item): | ||
# GH 22477 | ||
result = pd.Series('entry', index=[1], dtype=str) | ||
assert result.values.tolist() == ['entry'] | ||
|
||
def test_constructor_unicode_element_string_type(self): | ||
# GH 22477 | ||
result = pd.Series('ѐ', index=[1], dtype=str) | ||
assert result.values.tolist() == ['ѐ'] | ||
result = pd.Series(item, index=[1], dtype=str) | ||
assert result.iloc[0] == item | ||
|
||
def test_constructor_dtype_str_na_values(self, string_dtype): | ||
# https://github.com/pandas-dev/pandas/issues/21083 | ||
|
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.
pls parametrize these tests