Skip to content

Commit 7016e67

Browse files
committed
Run linter
1 parent 22499b8 commit 7016e67

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

pandas/core/base.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,16 +342,16 @@ def _aggregate(self, arg, *args, **kwargs):
342342
raise SpecificationError("nested renamer is not supported")
343343
elif isinstance(obj, ABCDataFrame):
344344
# GH 29268
345-
if (k not in obj.columns):
345+
if k not in obj.columns:
346346
# Check if list thingy
347347
try:
348-
keys = np.frombuffer(k, dtype=np.dtype('<U1'))
348+
keys = np.frombuffer(k, dtype=np.dtype("<U1"))
349349
except (AttributeError, TypeError):
350350
raise KeyError(f"Column '{k}' does not exist!")
351351

352352
# Check keys
353353
for key in keys:
354-
if (key not in obj.columns):
354+
if key not in obj.columns:
355355
raise KeyError(f"Column '{key}' does not exist!")
356356

357357
# Memorize operation
@@ -388,10 +388,11 @@ def _agg_2dim(how):
388388
"""
389389
colg = self._gotitem(self._selection, ndim=2, subset=obj)
390390
return colg.aggregate(how)
391-
391+
392392
# GH 29268
393393
def _agg_multi_dim(name, how, keys):
394394
from pandas.core.frame import DataFrame
395+
395396
_obj = {k: self._gotitem(k, ndim=1, subset=None) for k in keys}
396397
result = {com.get_callable_name(agg): agg(_obj) for agg in how}
397398
return DataFrame(result, columns=result.keys())

pandas/core/groupby/generic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,7 @@ def aggregate(self, func=None, *args, **kwargs):
921921
if relabeling:
922922
# GH 29268
923923
from types import LambdaType
924+
924925
for k, v in list(kwargs.items()):
925926
if isinstance(v[0], list) & isinstance(v[1], LambdaType):
926927
serialized_key = np.sort(np.array(v[0]))

pandas/tests/groupby/aggregate/test_aggregate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ def test_agg_multiple_columns(self):
640640
df = pd.DataFrame({"A": [0, 0, 1, 1], "B": [1, 2, 3, 4], "C": [3, 4, 5, 6]})
641641
result = df.groupby("A").agg(
642642
add=(["B", "C"], lambda x: x["B"].max() + x["C"].min()),
643-
minus=(["C", "B"], lambda x: x["B"].max() - x["C"].min())
643+
minus=(["C", "B"], lambda x: x["B"].max() - x["C"].min()),
644644
)
645645
expected = pd.DataFrame(
646646
{"add": [5, 9], "minus": [-1, -1]}, index=pd.Index([0, 1], name="A")

0 commit comments

Comments
 (0)