Skip to content

Commit 27b1ca5

Browse files
committed
Move test into right module.
1 parent 71a4390 commit 27b1ca5

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

pandas/tests/groupby/test_counting.py

-10
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,6 @@ def test_count_with_only_nans_in_first_group(self):
222222
expected = Series([], index=mi, dtype=np.int64, name="C")
223223
tm.assert_series_equal(result, expected, check_index_type=False)
224224

225-
def test_count_groupby_index_with_nan_in_index(self):
226-
# https://github.com/pandas-dev/pandas/issues/21824
227-
df = DataFrame({"Person": ["John", "Myla", None, "John", "Myla"],
228-
"Age": [24., 5, 21., 33, 26],
229-
"Single": [False, True, True, True, False]})
230-
231-
res = df.set_index(["Person", "Single"]).count(level="Person")
232-
expected = DataFrame(index=Index(["John", "Myla"], name="Person"),
233-
data={"Age": [2, 2]})
234-
235225
def test_count_groupby_column_with_nan_in_groupby_column(self):
236226
# https://github.com/pandas-dev/pandas/issues/32841
237227
df = DataFrame({"A": [1, 1, 1, 1, 1], "B": [5, 4, np.NaN, 3, 0]})

pandas/tests/test_multilevel.py

+11
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,17 @@ def _check_counts(frame, axis=0):
248248
result = self.frame.count(level=0, numeric_only=True)
249249
tm.assert_index_equal(result.columns, Index(list("ABC"), name="exp"))
250250

251+
def test_count_index_with_nan(self):
252+
# https://github.com/pandas-dev/pandas/issues/21824
253+
df = DataFrame({"Person": ["John", "Myla", None, "John", "Myla"],
254+
"Age": [24., 5, 21., 33, 26],
255+
"Single": [False, True, True, True, False]})
256+
257+
res = df.set_index(["Person", "Single"]).count(level="Person")
258+
expected = DataFrame(index=Index(["John", "Myla"], name="Person"),
259+
data={"Age": [2, 2]})
260+
261+
251262
def test_count_level_series(self):
252263
index = MultiIndex(
253264
levels=[["foo", "bar", "baz"], ["one", "two", "three", "four"]],

0 commit comments

Comments
 (0)