Skip to content

Commit d01c2f5

Browse files
committed
Merge pull request #7393 from cpcloud/groupby-max-fix-6346
BUG/TST: test for groupby max nan subselection bug
2 parents 2633722 + 0052396 commit d01c2f5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/test_groupby.py

+11
Original file line numberDiff line numberDiff line change
@@ -4369,6 +4369,17 @@ def test_ops_general(self):
43694369
exc.args += ('operation: %s' % op,)
43704370
raise
43714371

4372+
def test_max_nan_bug(self):
4373+
raw = """,Date,app,File
4374+
2013-04-23,2013-04-23 00:00:00,,log080001.log
4375+
2013-05-06,2013-05-06 00:00:00,,log.log
4376+
2013-05-07,2013-05-07 00:00:00,OE,xlsx"""
4377+
df = pd.read_csv(StringIO(raw), parse_dates=[0])
4378+
gb = df.groupby('Date')
4379+
r = gb[['File']].max()
4380+
e = gb['File'].max().to_frame()
4381+
tm.assert_frame_equal(r, e)
4382+
self.assertFalse(r['File'].isnull().any())
43724383

43734384
def assert_fp_equal(a, b):
43744385
assert (np.abs(a - b) < 1e-12).all()

0 commit comments

Comments
 (0)