Skip to content

Commit ec1f316

Browse files
author
Nicholas Ver Halen
committed
Created a test for GH 15021
1 parent b8b10b0 commit ec1f316

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pandas/tseries/tests/test_resample.py

+14
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,20 @@ def test_groupby_resample_api(self):
217217
lambda x: x.resample('1D').ffill())[['val']]
218218
assert_frame_equal(result, expected)
219219

220+
def test_grouby_resample_on_api(self):
221+
222+
# GH 15021
223+
# .groupby(...).resample(on=...) results in an unexpected
224+
# keyword warning.
225+
df = pd.DataFrame({'key': ['A', 'B'] * 5,
226+
'dates': pd.date_range('2016-01-01', periods=10),
227+
'values': np.random.randn(10)})
228+
229+
expected = df.set_index('dates').groupby('key').resample('D').mean()
230+
231+
result = df.groupby('key').resample('D', on='dates').mean()
232+
assert_frame_equal(result, expected)
233+
220234
def test_plot_api(self):
221235
tm._skip_if_no_mpl()
222236

0 commit comments

Comments
 (0)