From 2c2dacb4e6fe59ff361a89327ff9f39e450a11ac Mon Sep 17 00:00:00 2001 From: sidharthann Date: Sun, 22 Sep 2019 19:13:14 +0100 Subject: [PATCH] improve formatting #28247 --- pandas/core/groupby/generic.py | 5 ++--- pandas/tests/groupby/test_apply.py | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/groupby/generic.py b/pandas/core/groupby/generic.py index 0910be6a231c9..7a6f11667dcc4 100644 --- a/pandas/core/groupby/generic.py +++ b/pandas/core/groupby/generic.py @@ -1904,9 +1904,8 @@ def _recast_datetimelike_result(result: DataFrame) -> DataFrame: """ result = result.copy() - obj_cols = [ - idx for idx in range(len(result.columns)) if is_object_dtype(result.dtypes.iloc[idx]) - ] + obj_cols = [idx for idx in range(len(result.columns)) + if is_object_dtype(result.dtypes.iloc[idx])] # See GH#26285 for n in obj_cols: diff --git a/pandas/tests/groupby/test_apply.py b/pandas/tests/groupby/test_apply.py index 560e386c9d930..752a62b3226c5 100644 --- a/pandas/tests/groupby/test_apply.py +++ b/pandas/tests/groupby/test_apply.py @@ -665,5 +665,6 @@ def test_apply_datetime_issue(): df = pd.DataFrame({'a': ['foo'], 'b': [datetime.today()]}) result = df.groupby('a').apply(lambda x: pd.Series(['spam'], index=[42])) - expected = pd.DataFrame(['spam'], Index(['foo'], dtype='object', name='a'), columns=[42]) + expected = pd.DataFrame(['spam'], Index(['foo'], dtype='object', name='a'), + columns=[42]) tm.assert_frame_equal(result, expected)