8000 BUG:Time Grouper bug fix when applied for list groupers by ruiann · Pull Request #17587 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG:Time Grouper bug fix when applied for list groupers #17587

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

Merged
merged 10 commits into from
Oct 1, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move test to test time grouper
  • Loading branch information
ruiann authored and jreback committed Oct 1, 2017
commit 737c00ee783cfd1c5169a149ca2b56444f4b50e0
17 changes: 17 additions & 0 deletions pandas/tests/groupby/test_timegrouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,3 +623,20 @@ def test_nunique_with_timegrouper_and_nat(self):
result = test.groupby(grouper)['data'].nunique()
expected = test[test.time.notnull()].groupby(grouper)['data'].nunique()
tm.assert_series_equal(result, expected)

def test_scalar_call_versus_list_call(self):
# Issue: 17530
data_frame = {
'location': ['shanghai', 'beijing', 'shanghai'],
'time': pd.Series(['2017-08-09 13:32:23', '2017-08-11 23:23:15',
'2017-08-11 22:23:15'],
dtype='datetime64[ns]'),
'value': [1, 2, 3]
}
data_frame = pd.DataFrame(data_frame).set_index('time')
grouper = pd.TimeGrouper('D')
grouped = data_frame.groupby(grouper)
data1 = grouped.count()
grouped = data_frame.groupby([grouper])
data2 = grouped.count()
assert_frame_equal(data1, data2)
17 changes: 0 additions & 17 deletions pandas/tests/test_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -3380,20 +3380,3 @@ def test_aggregate_with_nat(self):

# if NaT is included, 'var', 'std', 'mean', 'first','last'
# and 'nth' doesn't work yet

# Issue: 17530
def test_scalar_call_versus_list_call(self):
data_frame = {
'location': ['shanghai', 'beijing', 'shanghai'],
'time': pd.Series(['2017-08-09 13:32:23', '2017-08-11 23:23:15',
'2017-08-11 22:23:15'],
dtype='datetime64[ns]'),
'value': [1, 2, 3]
}
data_frame = pd.DataFrame(data_frame).set_index('time')
grouper = TimeGrouper('D')
grouped = data_frame.groupby(grouper)
data1 = grouped.count()
grouped = data_frame.groupby([grouper])
data2 = grouped.count()
assert_frame_equal(data1, data2)
0