Skip to content

Commit a28c495

Browse files
committed
Add ReadMe
1 parent ab38ad9 commit a28c495

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

pandas/tests/indexes/multi/test_duplicates.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,21 @@ def test_duplicated_drop_duplicates():
307307

308308

309309
@pytest.mark.parametrize(
310-
"array,expected",
310+
"array,expected,dtype",
311311
[
312312
(
313-
[0, 1j, 1j, 1, 1 + 1j, 1 + 2j, 1 + 1j],
314-
Series([False, False, True, False, False, False, True], dtype=bool),
313+
[np.nan + np.nan * 1j, 0, 1j, 1j, 1, 1 + 1j, 1 + 2j, 1 + 1j, np.nan, np.nan + np.nan * 1j],
314+
Series([False, False, False, True, False, False, False, True, False, True], dtype=bool),
315+
np.complex64
316+
),
317+
318+
(
319+
[np.nan + np.nan * 1j, 0, 1j, 1j, 1, 1 + 1j, 1 + 2j, 1 + 1j, np.nan, np.nan + np.nan * 1j],
320+
Series([False, False, False, True, False, False, False, True, False, True], dtype=bool),
321+
np.complex128
315322
)
316323
],
317324
)
318-
def test_duplicated_series_complex_numbers(array, expected):
319-
result = Series(array, dtype=np.complex64).duplicated()
325+
def test_duplicated_series_complex_numbers(array, expected, dtype):
326+
result = Series(array, dtype=dtype).duplicated()
320327
tm.assert_series_equal(result, expected)

pandas/tests/series/methods/test_value_counts.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,16 @@ def test_value_counts_bool_with_nan(self, ser, dropna, exp):
208208
"input_array,expected",
209209
[
210210
(
211-
[1 + 1j, 0, 1, 1j, 1 + 2j],
212-
Series([1, 1, 1, 1, 1], index=[0, 1, 1j, 1 + 1j, 1 + 2j]),
211+
[1 + 1j, 0, 1 + 0j, 1j, 1 + 2j],
212+
Series([1, 1, 1, 1, 1], index=[0, 1 + 0j, 1j, 1 + 1j, 1 + 2j]),
213213
),
214214
(
215-
[1 + 2j, 0, 1j, 1, 1j, 1 + 1j],
215+
[1 + 2j, 0, 1j, 1, 1j, 1 + 1j, 1 + 1j],
216216
# index is sorted by value counts in descending order by default
217-
Series([2, 1, 1, 1, 1], index=[1j, 0, 1, 1 + 1j, 1 + 2j]),
217+
Series([2, 1, 1, 2, 1], index=pd.Index([1j, 0, 1, 1 + 1j, 1 + 2j], dtype=np.complex128)),
218218
),
219219
],
220220
)
221221
def test_value_counts_complex_numbers(self, input_array, expected):
222-
result = pd.value_counts(input_array)
223-
print(result)
222+
result = pd.Series(input_array, dtype=np.complex128).value_counts()
224223
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)