Skip to content

Commit 2a0cb4e

Browse files
committed
CLN remove unnecessary trailing commas in groupby tests
1 parent 0bc407a commit 2a0cb4e

File tree

8 files changed

+13
-19
lines changed

8 files changed

+13
-19
lines changed

pandas/tests/groupby/aggregate/test_numba.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def func_numba(values, index):
5757
func_numba = numba.jit(func_numba)
5858

5959
data = DataFrame(
60-
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1],
60+
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
6161
)
6262
engine_kwargs = {"nogil": nogil, "parallel": parallel, "nopython": nopython}
6363
grouped = data.groupby(0)
@@ -90,7 +90,7 @@ def func_2(values, index):
9090
func_2 = numba.jit(func_2)
9191

9292
data = DataFrame(
93-
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1],
93+
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
9494
)
9595
engine_kwargs = {"nogil": nogil, "parallel": parallel, "nopython": nopython}
9696
grouped = data.groupby(0)
@@ -121,7 +121,7 @@ def func_1(values, index):
121121
return np.mean(values) - 3.4
122122

123123
data = DataFrame(
124-
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1],
124+
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
125125
)
126126
grouped = data.groupby(0)
127127
expected = grouped.agg(func_1, engine="numba")
@@ -142,7 +142,7 @@ def func_1(values, index):
142142
)
143143
def test_multifunc_notimplimented(agg_func):
144144
data = DataFrame(
145-
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1],
145+
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
146146
)
147147
grouped = data.groupby(0)
148148
with pytest.raises(NotImplementedError, match="Numba engine can"):

pandas/tests/groupby/test_apply.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -946,9 +946,7 @@ def fct(group):
946946
tm.assert_series_equal(result, expected)
947947

948948

949-
@pytest.mark.parametrize(
950-
"function", [lambda gr: gr.index, lambda gr: gr.index + 1 - 1],
951-
)
949+
@pytest.mark.parametrize("function", [lambda gr: gr.index, lambda gr: gr.index + 1 - 1])
952950
def test_apply_function_index_return(function):
953951
# GH: 22541
954952
df = pd.DataFrame([1, 2, 2, 2, 1, 2, 3, 1, 3, 1], columns=["id"])

pandas/tests/groupby/test_categorical.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
def cartesian_product_for_groupers(result, args, names, fill_value=np.NaN):
20-
""" Reindex to a cartesian production for the groupers,
20+
"""Reindex to a cartesian production for the groupers,
2121
preserving the nature (Categorical) of each grouper
2222
"""
2323

pandas/tests/groupby/test_groupby_dropna.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,7 @@ def test_groupby_dropna_multi_index_dataframe_agg(dropna, tuples, outputs):
246246
(pd.Period("2020-01-01"), pd.Period("2020-02-01")),
247247
],
248248
)
249-
@pytest.mark.parametrize(
250-
"dropna, values", [(True, [12, 3]), (False, [12, 3, 6],)],
251-
)
249+
@pytest.mark.parametrize("dropna, values", [(True, [12, 3]), (False, [12, 3, 6])])
252250
def test_groupby_dropna_datetime_like_data(
253251
dropna, values, datetime1, datetime2, unique_nulls_fixture, unique_nulls_fixture2
254252
):

pandas/tests/groupby/test_groupby_subclass.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ def test_groupby_preserves_subclass(obj, groupby_func):
5151
tm.assert_series_equal(result1, result2)
5252

5353

54-
@pytest.mark.parametrize(
55-
"obj", [DataFrame, tm.SubclassedDataFrame],
56-
)
54+
@pytest.mark.parametrize("obj", [DataFrame, tm.SubclassedDataFrame])
5755
def test_groupby_resample_preserves_subclass(obj):
5856
# GH28330 -- preserve subclass through groupby.resample()
5957

pandas/tests/groupby/test_size.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_size_on_categorical(as_index):
5353
result = df.groupby(["A", "B"], as_index=as_index).size()
5454

5555
expected = DataFrame(
56-
[[1, 1, 1], [1, 2, 0], [2, 1, 0], [2, 2, 1]], columns=["A", "B", "size"],
56+
[[1, 1, 1], [1, 2, 0], [2, 1, 0], [2, 2, 1]], columns=["A", "B", "size"]
5757
)
5858
expected["A"] = expected["A"].astype("category")
5959
if as_index:

pandas/tests/groupby/test_timegrouper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,6 @@ def test_grouper_period_index(self):
780780
result = period_series.groupby(period_series.index.month).sum()
781781

782782
expected = pd.Series(
783-
range(0, periods), index=Index(range(1, periods + 1), name=index.name),
783+
range(0, periods), index=Index(range(1, periods + 1), name=index.name)
784784
)
785785
tm.assert_series_equal(result, expected)

pandas/tests/groupby/transform/test_numba.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def func(values, index):
5656
func = numba.jit(func)
5757

5858
data = DataFrame(
59-
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1],
59+
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
6060
)
6161
engine_kwargs = {"nogil": nogil, "parallel": parallel, "nopython": nopython}
6262
grouped = data.groupby(0)
@@ -89,7 +89,7 @@ def func_2(values, index):
8989
func_2 = numba.jit(func_2)
9090

9191
data = DataFrame(
92-
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1],
92+
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
9393
)
9494
engine_kwargs = {"nogil": nogil, "parallel": parallel, "nopython": nopython}
9595
grouped = data.groupby(0)
@@ -120,7 +120,7 @@ def func_1(values, index):
120120
return values + 1
121121

122122
data = DataFrame(
123-
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1],
123+
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
124124
)
125125
grouped = data.groupby(0)
126126
expected = grouped.transform(func_1, engine="numba")

0 commit comments

Comments
 (0)