Skip to content

Commit 1fc244f

Browse files
Comma cleanup for #35925 (#36058)
1 parent 73c1d32 commit 1fc244f

9 files changed

+16
-26
lines changed

pandas/tests/generic/test_finalize.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
(pd.DataFrame, frame_data, operator.methodcaller("sort_index")),
124124
(pd.DataFrame, frame_data, operator.methodcaller("nlargest", 1, "A")),
125125
(pd.DataFrame, frame_data, operator.methodcaller("nsmallest", 1, "A")),
126-
(pd.DataFrame, frame_mi_data, operator.methodcaller("swaplevel"),),
126+
(pd.DataFrame, frame_mi_data, operator.methodcaller("swaplevel")),
127127
pytest.param(
128128
(
129129
pd.DataFrame,
@@ -178,7 +178,7 @@
178178
marks=not_implemented_mark,
179179
),
180180
pytest.param(
181-
(pd.DataFrame, frame_mi_data, operator.methodcaller("unstack"),),
181+
(pd.DataFrame, frame_mi_data, operator.methodcaller("unstack")),
182182
marks=not_implemented_mark,
183183
),
184184
pytest.param(
@@ -317,7 +317,7 @@
317317
marks=not_implemented_mark,
318318
),
319319
pytest.param(
320-
(pd.Series, ([1, 2],), operator.methodcaller("squeeze")),
320+
(pd.Series, ([1, 2],), operator.methodcaller("squeeze"))
321321
# marks=not_implemented_mark,
322322
),
323323
(pd.Series, ([1, 2],), operator.methodcaller("rename_axis", index="a")),
@@ -733,9 +733,7 @@ def test_timedelta_property(attr):
733733
assert result.attrs == {"a": 1}
734734

735735

736-
@pytest.mark.parametrize(
737-
"method", [operator.methodcaller("total_seconds")],
738-
)
736+
@pytest.mark.parametrize("method", [operator.methodcaller("total_seconds")])
739737
@not_implemented_mark
740738
def test_timedelta_methods(method):
741739
s = pd.Series(pd.timedelta_range("2000", periods=4))

pandas/tests/generic/test_to_xarray.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ def test_to_xarray_index_types(self, index):
4747
expected = df.copy()
4848
expected["f"] = expected["f"].astype(object)
4949
expected.columns.name = None
50-
tm.assert_frame_equal(
51-
result.to_dataframe(), expected,
52-
)
50+
tm.assert_frame_equal(result.to_dataframe(), expected)
5351

5452
@td.skip_if_no("xarray", min_version="0.7.0")
5553
def test_to_xarray(self):

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

+2-2
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

@@ -1449,7 +1449,7 @@ def test_groupby_agg_categorical_columns(func, expected_values):
14491449
result = df.groupby("groups").agg(func)
14501450

14511451
expected = pd.DataFrame(
1452-
{"value": expected_values}, index=pd.Index([0, 1, 2], name="groups"),
1452+
{"value": expected_values}, index=pd.Index([0, 1, 2], name="groups")
14531453
)
14541454
tm.assert_frame_equal(result, expected)
14551455

pandas/tests/groupby/test_groupby.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ def test_ops_not_as_index(reduction_func):
676676
if reduction_func in ("corrwith",):
677677
pytest.skip("Test not applicable")
678678

679-
if reduction_func in ("nth", "ngroup",):
679+
if reduction_func in ("nth", "ngroup"):
680680
pytest.skip("Skip until behavior is determined (GH #5755)")
681681

682682
df = DataFrame(np.random.randint(0, 5, size=(100, 2)), columns=["a", "b"])

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:

0 commit comments

Comments
 (0)