From c8844e085654dd462a91b56ec2bf0d3dc5fdbfa6 Mon Sep 17 00:00:00 2001 From: Greg Williams Date: Tue, 14 Mar 2017 07:08:10 -0400 Subject: [PATCH] CLN: PEP8 (whitespace fixes) --- pandas/core/groupby.py | 3 ++- pandas/tests/groupby/test_groupby.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py index fff28c329494b..5a0bc590eb4f4 100644 --- a/pandas/core/groupby.py +++ b/pandas/core/groupby.py @@ -3568,7 +3568,8 @@ def first_non_None_value(values): # as we are stacking can easily have object dtypes here so = self._selected_obj if (so.ndim == 2 and so.dtypes.apply(is_datetimelike).any()): - result = result.apply(lambda x: pd.to_numeric(x, errors='ignore')) + result = result.apply( + lambda x: pd.to_numeric(x, errors='ignore')) date_cols = self._selected_obj.select_dtypes( include=['datetime', 'timedelta']).columns date_cols = date_cols.intersection(result.columns) diff --git a/pandas/tests/groupby/test_groupby.py b/pandas/tests/groupby/test_groupby.py index fb0a103caef59..263eb6497e990 100644 --- a/pandas/tests/groupby/test_groupby.py +++ b/pandas/tests/groupby/test_groupby.py @@ -4316,12 +4316,15 @@ def test_cummin_cummax(self): def test_numeric_coercion(self): # GH 14423 - df = pd.DataFrame({'Number' : [1, 2], 'Date' : ["2017-03-02"] * 2, 'Str' : ["foo", "inf"]}) + df = pd.DataFrame({'Number': [1, 2], + 'Date': ["2017-03-02"] * 2, + 'Str': ["foo", "inf"]}) expected = df.groupby(['Number']).apply(lambda x: x.iloc[0]) df.Date = pd.to_datetime(df.Date) result = df.groupby(['Number']).apply(lambda x: x.iloc[0]) tm.assert_series_equal(result['Str'], expected['Str']) - + + def _check_groupby(df, result, keys, field, f=lambda x: x.sum()): tups = lmap(tuple, df[keys].values) tups = com._asarray_tuplesafe(tups)