Skip to content

Commit e5af011

Browse files
authored
Issue35925 Remove trailing commas (#35996)
* pandas/tests/test_multilevel.py * pandas/tests/test_nanops.py * pandas/.../test_moments_consistency_rolling.py * pandas/tests/window/moments/test_moments_ewm.py * pandas/.../test_moments_rolling.py * pandas/tests/window/test_base_indexer.py * pandas/tests/window/test_pairwise.py * pandas/tests/window/test_rolling.py * pandas/tseries/frequencies.py * pandas/util/_test_decorators.py
1 parent 1a576eb commit e5af011

10 files changed

+23
-23
lines changed

pandas/tests/test_multilevel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ def test_multilevel_index_loc_order(self, dim, keys, expected):
18461846
# GH 22797
18471847
# Try to respect order of keys given for MultiIndex.loc
18481848
kwargs = {dim: [["c", "a", "a", "b", "b"], [1, 1, 2, 1, 2]]}
1849-
df = pd.DataFrame(np.arange(25).reshape(5, 5), **kwargs,)
1849+
df = pd.DataFrame(np.arange(25).reshape(5, 5), **kwargs)
18501850
exp_index = MultiIndex.from_arrays(expected)
18511851
if dim == "index":
18521852
res = df.loc[keys, :]

pandas/tests/test_nanops.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def test_nansum(self, skipna):
285285

286286
def test_nanmean(self, skipna):
287287
self.check_funs(
288-
nanops.nanmean, np.mean, skipna, allow_obj=False, allow_date=False,
288+
nanops.nanmean, np.mean, skipna, allow_obj=False, allow_date=False
289289
)
290290

291291
def test_nanmean_overflow(self):

pandas/tests/window/moments/test_moments_consistency_rolling.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def test_rolling_apply_consistency(
9595

9696
with warnings.catch_warnings():
9797
warnings.filterwarnings(
98-
"ignore", message=".*(empty slice|0 for slice).*", category=RuntimeWarning,
98+
"ignore", message=".*(empty slice|0 for slice).*", category=RuntimeWarning
9999
)
100100
# test consistency between rolling_xyz() and either (a)
101101
# rolling_apply of Series.xyz(), or (b) rolling_apply of
@@ -107,7 +107,7 @@ def test_rolling_apply_consistency(
107107
functions = no_nan_functions + base_functions
108108
for (f, require_min_periods, name) in functions:
109109
rolling_f = getattr(
110-
x.rolling(window=window, center=center, min_periods=min_periods), name,
110+
x.rolling(window=window, center=center, min_periods=min_periods), name
111111
)
112112

113113
if (
@@ -492,7 +492,7 @@ def test_moment_functions_zero_length_pairwise():
492492
df2["a"] = df2["a"].astype("float64")
493493

494494
df1_expected = DataFrame(
495-
index=pd.MultiIndex.from_product([df1.index, df1.columns]), columns=Index([]),
495+
index=pd.MultiIndex.from_product([df1.index, df1.columns]), columns=Index([])
496496
)
497497
df2_expected = DataFrame(
498498
index=pd.MultiIndex.from_product(
@@ -635,7 +635,7 @@ def test_rolling_consistency(consistency_data, window, min_periods, center):
635635
# with empty/0-length Series/DataFrames
636636
with warnings.catch_warnings():
637637
warnings.filterwarnings(
638-
"ignore", message=".*(empty slice|0 for slice).*", category=RuntimeWarning,
638+
"ignore", message=".*(empty slice|0 for slice).*", category=RuntimeWarning
639639
)
640640

641641
# test consistency between different rolling_* moments

pandas/tests/window/moments/test_moments_ewm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def simple_wma(s, w):
7373
(s1, True, True, [(1.0 - alpha), np.nan, 1.0]),
7474
(s1, False, False, [(1.0 - alpha) ** 2, np.nan, alpha]),
7575
(s1, False, True, [(1.0 - alpha), np.nan, alpha]),
76-
(s2, True, False, [np.nan, (1.0 - alpha) ** 3, np.nan, np.nan, 1.0, np.nan],),
76+
(s2, True, False, [np.nan, (1.0 - alpha) ** 3, np.nan, np.nan, 1.0, np.nan]),
7777
(s2, True, True, [np.nan, (1.0 - alpha), np.nan, np.nan, 1.0, np.nan]),
7878
(
7979
s2,
@@ -95,7 +95,7 @@ def simple_wma(s, w):
9595
alpha * ((1.0 - alpha) ** 2 + alpha),
9696
],
9797
),
98-
(s3, False, True, [(1.0 - alpha) ** 2, np.nan, (1.0 - alpha) * alpha, alpha],),
98+
(s3, False, True, [(1.0 - alpha) ** 2, np.nan, (1.0 - alpha) * alpha, alpha]),
9999
]:
100100
expected = simple_wma(s, Series(w))
101101
result = s.ewm(com=com, adjust=adjust, ignore_na=ignore_na).mean()

pandas/tests/window/moments/test_moments_rolling.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ def get_result(obj, window, min_periods=None, center=False):
150150

151151
series_xp = (
152152
get_result(
153-
series.reindex(list(series.index) + s), window=25, min_periods=minp,
153+
series.reindex(list(series.index) + s), window=25, min_periods=minp
154154
)
155155
.shift(-12)
156156
.reindex(series.index)
157157
)
158158
frame_xp = (
159159
get_result(
160-
frame.reindex(list(frame.index) + s), window=25, min_periods=minp,
160+
frame.reindex(list(frame.index) + s), window=25, min_periods=minp
161161
)
162162
.shift(-12)
163163
.reindex(frame.index)
@@ -169,14 +169,14 @@ def get_result(obj, window, min_periods=None, center=False):
169169
else:
170170
series_xp = (
171171
get_result(
172-
series.reindex(list(series.index) + s), window=25, min_periods=0,
172+
series.reindex(list(series.index) + s), window=25, min_periods=0
173173
)
174174
.shift(-12)
175175
.reindex(series.index)
176176
)
177177
frame_xp = (
178178
get_result(
179-
frame.reindex(list(frame.index) + s), window=25, min_periods=0,
179+
frame.reindex(list(frame.index) + s), window=25, min_periods=0
180180
)
181181
.shift(-12)
182182
.reindex(frame.index)

pandas/tests/window/test_base_indexer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def get_window_bounds(self, num_values, min_periods, center, closed):
8888
@pytest.mark.parametrize(
8989
"func,np_func,expected,np_kwargs",
9090
[
91-
("count", len, [3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 2.0, np.nan], {},),
92-
("min", np.min, [0.0, 1.0, 2.0, 3.0, 4.0, 6.0, 6.0, 7.0, 8.0, np.nan], {},),
91+
("count", len, [3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 2.0, np.nan], {}),
92+
("min", np.min, [0.0, 1.0, 2.0, 3.0, 4.0, 6.0, 6.0, 7.0, 8.0, np.nan], {}),
9393
(
9494
"max",
9595
np.max,
@@ -204,7 +204,7 @@ def test_rolling_forward_skewness(constructor):
204204
@pytest.mark.parametrize(
205205
"func,expected",
206206
[
207-
("cov", [2.0, 2.0, 2.0, 97.0, 2.0, -93.0, 2.0, 2.0, np.nan, np.nan],),
207+
("cov", [2.0, 2.0, 2.0, 97.0, 2.0, -93.0, 2.0, 2.0, np.nan, np.nan]),
208208
(
209209
"corr",
210210
[

pandas/tests/window/test_pairwise.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def test_cov_mulittindex(self):
195195

196196
columns = MultiIndex.from_product([list("ab"), list("xy"), list("AB")])
197197
index = range(3)
198-
df = DataFrame(np.arange(24).reshape(3, 8), index=index, columns=columns,)
198+
df = DataFrame(np.arange(24).reshape(3, 8), index=index, columns=columns)
199199

200200
result = df.ewm(alpha=0.1).cov()
201201

pandas/tests/window/test_rolling.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_constructor_with_timedelta_window(window):
7373
# GH 15440
7474
n = 10
7575
df = DataFrame(
76-
{"value": np.arange(n)}, index=pd.date_range("2015-12-24", periods=n, freq="D"),
76+
{"value": np.arange(n)}, index=pd.date_range("2015-12-24", periods=n, freq="D")
7777
)
7878
expected_data = np.append([0.0, 1.0], np.arange(3.0, 27.0, 3))
7979

@@ -92,7 +92,7 @@ def test_constructor_timedelta_window_and_minperiods(window, raw):
9292
# GH 15305
9393
n = 10
9494
df = DataFrame(
95-
{"value": np.arange(n)}, index=pd.date_range("2017-08-08", periods=n, freq="D"),
95+
{"value": np.arange(n)}, index=pd.date_range("2017-08-08", periods=n, freq="D")
9696
)
9797
expected = DataFrame(
9898
{"value": np.append([np.NaN, 1.0], np.arange(3.0, 27.0, 3))},
@@ -153,7 +153,7 @@ def test_closed_one_entry(func):
153153
def test_closed_one_entry_groupby(func):
154154
# GH24718
155155
ser = pd.DataFrame(
156-
data={"A": [1, 1, 2], "B": [3, 2, 1]}, index=pd.date_range("2000", periods=3),
156+
data={"A": [1, 1, 2], "B": [3, 2, 1]}, index=pd.date_range("2000", periods=3)
157157
)
158158
result = getattr(
159159
ser.groupby("A", sort=False)["B"].rolling("10D", closed="left"), func
@@ -182,7 +182,7 @@ def test_closed_one_entry_groupby(func):
182182
def test_closed_min_max_datetime(input_dtype, func, closed, expected):
183183
# see gh-21704
184184
ser = pd.Series(
185-
data=np.arange(10).astype(input_dtype), index=pd.date_range("2000", periods=10),
185+
data=np.arange(10).astype(input_dtype), index=pd.date_range("2000", periods=10)
186186
)
187187

188188
result = getattr(ser.rolling("3D", closed=closed), func)()

pandas/tseries/frequencies.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ def is_superperiod(source, target) -> bool:
548548

549549

550550
def _maybe_coerce_freq(code) -> str:
551-
""" we might need to coerce a code to a rule_code
551+
"""we might need to coerce a code to a rule_code
552552
and uppercase it
553553
554554
Parameters

pandas/util/_test_decorators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ def skip_if_no(package: str, min_version: Optional[str] = None):
186186
is_platform_windows(), reason="not used on win32"
187187
)
188188
skip_if_has_locale = pytest.mark.skipif(
189-
_skip_if_has_locale(), reason=f"Specific locale is set {locale.getlocale()[0]}",
189+
_skip_if_has_locale(), reason=f"Specific locale is set {locale.getlocale()[0]}"
190190
)
191191
skip_if_not_us_locale = pytest.mark.skipif(
192-
_skip_if_not_us_locale(), reason=f"Specific locale is set {locale.getlocale()[0]}",
192+
_skip_if_not_us_locale(), reason=f"Specific locale is set {locale.getlocale()[0]}"
193193
)
194194
skip_if_no_scipy = pytest.mark.skipif(
195195
_skip_if_no_scipy(), reason="Missing SciPy requirement"

0 commit comments

Comments
 (0)