Skip to content

Comma cleanup #35971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions pandas/tests/frame/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ def wrapper(x):
result0 = f(axis=0, skipna=False)
result1 = f(axis=1, skipna=False)
tm.assert_series_equal(
result0,
frame.apply(wrapper),
check_dtype=check_dtype,
rtol=rtol,
atol=atol,
result0, frame.apply(wrapper), check_dtype=check_dtype, rtol=rtol, atol=atol
)
# HACK: win32
tm.assert_series_equal(
Expand All @@ -116,7 +112,15 @@ def wrapper(x):
if opname in ["sum", "prod"]:
expected = frame.apply(skipna_wrapper, axis=1)
tm.assert_series_equal(
result1, expected, check_dtype=False, rtol=rtol, atol=atol,
<<<<<<< HEAD
result1, expected, check_dtype=False, rtol=rtol, atol=atol
=======
result1,
expected,
check_dtype=False,
rtol=rtol,
atol=atol,
>>>>>>> c34ed0ebf1599a6ea21cf94846e4c7a8bb72a298
)

# check dtypes
Expand Down
8 changes: 7 additions & 1 deletion pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,13 @@ def test_constructor_mrecarray(self):
# from GH3479

assert_fr_equal = functools.partial(
tm.assert_frame_equal, check_index_type=True, check_column_type=True,
<<<<<<< HEAD
tm.assert_frame_equal, check_index_type=True, check_column_type=True
=======
tm.assert_frame_equal,
check_index_type=True,
check_column_type=True,
>>>>>>> c34ed0ebf1599a6ea21cf94846e4c7a8bb72a298
)
arrays = [
("float", np.array([1.5, 2.0])),
Expand Down
11 changes: 9 additions & 2 deletions pandas/tests/frame/test_reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,9 @@ def test_unstack_mixed_type_name_in_multiindex(
result = df.unstack(unstack_idx)

expected = pd.DataFrame(
expected_values, columns=expected_columns, index=expected_index,
expected_values,
columns=expected_columns,
index=expected_index,
)
tm.assert_frame_equal(result, expected)

Expand Down Expand Up @@ -807,7 +809,12 @@ def test_unstack_multi_level_cols(self):
[["B", "C"], ["B", "D"]], names=["c1", "c2"]
),
index=pd.MultiIndex.from_tuples(
[[10, 20, 30], [10, 20, 40]], names=["i1", "i2", "i3"],
<<<<<<< HEAD
[[10, 20, 30], [10, 20, 40]], names=["i1", "i2", "i3"]
=======
[[10, 20, 30], [10, 20, 40]],
names=["i1", "i2", "i3"],
>>>>>>> c34ed0ebf1599a6ea21cf94846e4c7a8bb72a298
),
)
assert df.unstack(["i2", "i1"]).columns.names[-2:] == ["i2", "i1"]
Expand Down
21 changes: 17 additions & 4 deletions pandas/tests/generic/test_finalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@
(pd.DataFrame, frame_data, operator.methodcaller("sort_index")),
(pd.DataFrame, frame_data, operator.methodcaller("nlargest", 1, "A")),
(pd.DataFrame, frame_data, operator.methodcaller("nsmallest", 1, "A")),
(pd.DataFrame, frame_mi_data, operator.methodcaller("swaplevel"),),
(
pd.DataFrame,
frame_mi_data,
operator.methodcaller("swaplevel"),
),
pytest.param(
(
pd.DataFrame,
Expand Down Expand Up @@ -178,7 +182,11 @@
marks=not_implemented_mark,
),
pytest.param(
(pd.DataFrame, frame_mi_data, operator.methodcaller("unstack"),),
(
pd.DataFrame,
frame_mi_data,
operator.methodcaller("unstack"),
),
marks=not_implemented_mark,
),
pytest.param(
Expand Down Expand Up @@ -317,7 +325,7 @@
marks=not_implemented_mark,
),
pytest.param(
(pd.Series, ([1, 2],), operator.methodcaller("squeeze")),
(pd.Series, ([1, 2],), operator.methodcaller("squeeze"))
# marks=not_implemented_mark,
),
(pd.Series, ([1, 2],), operator.methodcaller("rename_axis", index="a")),
Expand Down Expand Up @@ -733,9 +741,14 @@ def test_timedelta_property(attr):
assert result.attrs == {"a": 1}


<<<<<<< HEAD
@pytest.mark.parametrize("method", [operator.methodcaller("total_seconds")])
=======
@pytest.mark.parametrize(
"method", [operator.methodcaller("total_seconds")],
"method",
[operator.methodcaller("total_seconds")],
)
>>>>>>> c34ed0ebf1599a6ea21cf94846e4c7a8bb72a298
@not_implemented_mark
def test_timedelta_methods(method):
s = pd.Series(pd.timedelta_range("2000", periods=4))
Expand Down
4 changes: 1 addition & 3 deletions pandas/tests/generic/test_to_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ def test_to_xarray_index_types(self, index):
expected = df.copy()
expected["f"] = expected["f"].astype(object)
expected.columns.name = None
tm.assert_frame_equal(
result.to_dataframe(), expected,
)
tm.assert_frame_equal(result.to_dataframe(), expected)

@td.skip_if_no("xarray", min_version="0.7.0")
def test_to_xarray(self):
Expand Down
28 changes: 24 additions & 4 deletions pandas/tests/groupby/aggregate/test_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ def func_numba(values, index):
func_numba = numba.jit(func_numba)

data = DataFrame(
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1],
<<<<<<< HEAD
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
=======
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]},
columns=[0, 1],
>>>>>>> c34ed0ebf1599a6ea21cf94846e4c7a8bb72a298
)
engine_kwargs = {"nogil": nogil, "parallel": parallel, "nopython": nopython}
grouped = data.groupby(0)
Expand Down Expand Up @@ -90,7 +95,12 @@ def func_2(values, index):
func_2 = numba.jit(func_2)

data = DataFrame(
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1],
<<<<<<< HEAD
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
=======
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]},
columns=[0, 1],
>>>>>>> c34ed0ebf1599a6ea21cf94846e4c7a8bb72a298
)
engine_kwargs = {"nogil": nogil, "parallel": parallel, "nopython": nopython}
grouped = data.groupby(0)
Expand Down Expand Up @@ -121,7 +131,12 @@ def func_1(values, index):
return np.mean(values) - 3.4

data = DataFrame(
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1],
<<<<<<< HEAD
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
=======
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]},
columns=[0, 1],
>>>>>>> c34ed0ebf1599a6ea21cf94846e4c7a8bb72a298
)
grouped = data.groupby(0)
expected = grouped.agg(func_1, engine="numba")
Expand All @@ -142,7 +157,12 @@ def func_1(values, index):
)
def test_multifunc_notimplimented(agg_func):
data = DataFrame(
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1],
<<<<<<< HEAD
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=[0, 1]
=======
{0: ["a", "a", "b", "b", "a"], 1: [1.0, 2.0, 3.0, 4.0, 5.0]},
columns=[0, 1],
>>>>>>> c34ed0ebf1599a6ea21cf94846e4c7a8bb72a298
)
grouped = data.groupby(0)
with pytest.raises(NotImplementedError, match="Numba engine can"):
Expand Down
4 changes: 1 addition & 3 deletions pandas/tests/groupby/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,7 @@ def fct(group):
tm.assert_series_equal(result, expected)


@pytest.mark.parametrize(
"function", [lambda gr: gr.index, lambda gr: gr.index + 1 - 1],
)
@pytest.mark.parametrize("function", [lambda gr: gr.index, lambda gr: gr.index + 1 - 1])
def test_apply_function_index_return(function):
# GH: 22541
df = pd.DataFrame([1, 2, 2, 2, 1, 2, 3, 1, 3, 1], columns=["id"])
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/groupby/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


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

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

expected = pd.DataFrame(
{"value": expected_values}, index=pd.Index([0, 1, 2], name="groups"),
{"value": expected_values}, index=pd.Index([0, 1, 2], name="groups")
)
tm.assert_frame_equal(result, expected)

Expand Down