Skip to content

Commit 5626043

Browse files
black
1 parent 26b8ee7 commit 5626043

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

pandas/tests/groupby/aggregate/test_aggregate.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,10 @@ def test_agg_str_with_kwarg_axis_1_raises(df, reduction_func):
250250
"func, expected, dtype, result_dtype_dict",
251251
[
252252
("sum", [5, 7, 9], "int64", {}),
253-
("std", [4.5**0.5] * 3, int, {"i": float, "j": float, "k": float}),
253+
("std", [4.5 ** 0.5] * 3, int, {"i": float, "j": float, "k": float}),
254254
("var", [4.5] * 3, int, {"i": float, "j": float, "k": float}),
255255
("sum", [5, 7, 9], "Int64", {"j": "int64"}),
256-
("std", [4.5**0.5] * 3, "Int64", {"i": float, "j": float, "k": float}),
256+
("std", [4.5 ** 0.5] * 3, "Int64", {"i": float, "j": float, "k": float}),
257257
("var", [4.5] * 3, "Int64", {"i": "float64", "j": "float64", "k": "float64"}),
258258
],
259259
)
@@ -280,7 +280,7 @@ def test_multiindex_groupby_mixed_cols_axis1(func, expected, dtype, result_dtype
280280
[
281281
("sum", [[2, 4], [10, 12], [18, 20]], {10: "int64", 20: "int64"}),
282282
# std should ideally return Int64 / Float64 #43330
283-
("std", [[2**0.5] * 2] * 3, "float64"),
283+
("std", [[2 ** 0.5] * 2] * 3, "float64"),
284284
("var", [[2] * 2] * 3, {10: "float64", 20: "float64"}),
285285
],
286286
)
@@ -524,8 +524,7 @@ def test_groupby_agg_dict_with_getitem():
524524
def test_groupby_agg_dict_dup_columns():
525525
# GH#55006
526526
df = DataFrame(
527-
[[1, 2, 3, 4], [1, 3, 4, 5], [2, 4, 5, 6]],
528-
columns=["a", "b", "c", "c"],
527+
[[1, 2, 3, 4], [1, 3, 4, 5], [2, 4, 5, 6]], columns=["a", "b", "c", "c"],
529528
)
530529
gb = df.groupby("a")
531530
result = gb.agg({"b": "sum"})
@@ -889,11 +888,12 @@ def f(x):
889888
raise ValueError("length must not be 0")
890889
return len(x)
891890

892-
df = DataFrame({"A": pd.Categorical(['a', 'a'],
893-
categories=['a', 'b', 'c']), "B": [1, 1]})
894-
msg = 'length must not be 0'
891+
df = DataFrame(
892+
{"A": pd.Categorical(["a", "a"], categories=["a", "b", "c"]), "B": [1, 1]}
893+
)
894+
msg = "length must not be 0"
895895
with pytest.raises(ValueError, match=msg):
896-
df.groupby('A').agg(f)
896+
df.groupby("A").agg(f)
897897

898898
def test_agg_namedtuple(self):
899899
df = DataFrame({"A": [0, 1], "B": [1, 2]})
@@ -1198,7 +1198,7 @@ def test_agg_with_one_lambda(self):
11981198
# check pd.NameAgg case
11991199
result1 = df.groupby(by="kind").agg(
12001200
height_sqr_min=pd.NamedAgg(
1201-
column="height", aggfunc=lambda x: np.min(x**2)
1201+
column="height", aggfunc=lambda x: np.min(x ** 2)
12021202
),
12031203
height_max=pd.NamedAgg(column="height", aggfunc="max"),
12041204
weight_max=pd.NamedAgg(column="weight", aggfunc="max"),
@@ -1207,7 +1207,7 @@ def test_agg_with_one_lambda(self):
12071207

12081208
# check agg(key=(col, aggfunc)) case
12091209
result2 = df.groupby(by="kind").agg(
1210-
height_sqr_min=("height", lambda x: np.min(x**2)),
1210+
height_sqr_min=("height", lambda x: np.min(x ** 2)),
12111211
height_max=("height", "max"),
12121212
weight_max=("weight", "max"),
12131213
)
@@ -1244,7 +1244,7 @@ def test_agg_multiple_lambda(self):
12441244

12451245
# check agg(key=(col, aggfunc)) case
12461246
result1 = df.groupby(by="kind").agg(
1247-
height_sqr_min=("height", lambda x: np.min(x**2)),
1247+
height_sqr_min=("height", lambda x: np.min(x ** 2)),
12481248
height_max=("height", "max"),
12491249
weight_max=("weight", "max"),
12501250
height_max_2=("height", lambda x: np.max(x)),
@@ -1255,7 +1255,7 @@ def test_agg_multiple_lambda(self):
12551255
# check pd.NamedAgg case
12561256
result2 = df.groupby(by="kind").agg(
12571257
height_sqr_min=pd.NamedAgg(
1258-
column="height", aggfunc=lambda x: np.min(x**2)
1258+
column="height", aggfunc=lambda x: np.min(x ** 2)
12591259
),
12601260
height_max=pd.NamedAgg(column="height", aggfunc="max"),
12611261
weight_max=pd.NamedAgg(column="weight", aggfunc="max"),

0 commit comments

Comments
 (0)