def test_agg_consistency():

    def P1(a):
        try:
            return np.percentile(a.dropna(), q=1)
        except Exception:
            return np.nan
    df = DataFrame({'col1': [1, 2, 3, 4], 'col2': [10, 25, 26, 31], 'date': [dt.date(2013, 2, 10), dt.date(2013, 2, 10), dt.date(2013, 2, 11), dt.date(2013, 2, 11)]})
    g = df.groupby('date')
    expected = g.agg([P1])
    expected.columns = expected.columns.levels[0]
    result = g.agg(P1)
    tm.assert_frame_equal(result, expected)
def test_agg_consistency():

    def P1(a):
        try:
            return np.percentile(a.dropna(), q=1)
        except Exception:
            return np.nan
    df = DataFrame({'col1': [1, 2, 3, 4], 'col2': [10, 25, 26, 31], 'date': [dt.date(2013, 2, 10), dt.date(2013, 2, 10), dt.date(2013, 2, 11), dt.date(2013, 2, 11)]})
    g = df.groupby('date')
    expected = g.agg([P1])
    expected.columns = expected.columns.levels[0]
    result = g.agg(P1)
    tm.assert_frame_equal(result, expected)