Skip to content

Commit c69cfd5

Browse files
committed
Blacken
1 parent bc07b2e commit c69cfd5

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

pandas/tests/groupby/test_grouping.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -692,25 +692,27 @@ def test_groupby_multiindex_level_empty(self):
692692
tm.assert_frame_equal(result, expected)
693693

694694
def test_default_observed_deprecated(self):
695-
df = pd.DataFrame([
696-
['A', 1, 1], ['A', 2, 1], ['B', 1, 1]
697-
], columns=['x', 'y', 'z'])
698-
df.x = df.x.astype('category')
699-
df.y = df.x.astype('category')
695+
df = pd.DataFrame(
696+
[["A", 1, 1], ["A", 2, 1], ["B", 1, 1]], columns=["x", "y", "z"]
697+
)
698+
df.x = df.x.astype("category")
699+
df.y = df.x.astype("category")
700700

701-
with tm.assert_produces_warning(expected_warning=FutureWarning,
702-
check_stacklevel=False):
703-
df.groupby(['x', 'y'])
701+
with tm.assert_produces_warning(
702+
expected_warning=FutureWarning, check_stacklevel=False
703+
):
704+
df.groupby(["x", "y"])
704705

705706
with pytest.warns(None) as any_warnings:
706-
df.groupby(['x', 'y'], observed=True)
707-
df.groupby(['x', 'y'], observed=False)
707+
df.groupby(["x", "y"], observed=True)
708+
df.groupby(["x", "y"], observed=False)
708709
assert len(any_warnings) == 0
709710

710-
cat = pd.Categorical(['A', 'B', 'C'], categories=['A', 'B', 'C', 'D'])
711+
cat = pd.Categorical(["A", "B", "C"], categories=["A", "B", "C", "D"])
711712
s = Series(cat)
712-
with tm.assert_produces_warning(expected_warning=FutureWarning,
713-
check_stacklevel=False):
713+
with tm.assert_produces_warning(
714+
expected_warning=FutureWarning, check_stacklevel=False
715+
):
714716
s.groupby(cat)
715717

716718

pandas/tests/reshape/test_pivot.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ def test_pivot_table(self, observed):
8484
index = ["A", "B"]
8585
columns = "C"
8686
table = pivot_table(
87-
self.data, values="D", index=index, columns=columns,
88-
observed=observed)
87+
self.data, values="D", index=index, columns=columns, observed=observed
88+
)
8989

9090
table2 = self.data.pivot_table(
9191
values="D", index=index, columns=columns, observed=observed
@@ -2077,10 +2077,7 @@ def agg(l):
20772077
foo.pivot_table("notpresent", "X", "Y", aggfunc=agg)
20782078

20792079
def test_pivot_table_observed_deprecated_default(self):
2080-
with tm.assert_produces_warning(FutureWarning,
2081-
check_stacklevel=False):
2080+
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
20822081
# make sure we actually have a category to warn on
2083-
self.data.A = self.data.A.astype('category')
2084-
self.data.pivot_table(values="D", index=["A", "B"],
2085-
columns=["C"])
2086-
2082+
self.data.A = self.data.A.astype("category")
2083+
self.data.pivot_table(values="D", index=["A", "B"], columns=["C"])

0 commit comments

Comments
 (0)