Skip to content

Commit bfcf579

Browse files
committed
mypy add type: ignore[assignment]
1 parent 0807828 commit bfcf579

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pandas/core/reshape/pivot.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def pivot_table(
9898
values = list(values)
9999

100100
grouped = data.groupby(keys, observed=observed)
101-
agged = grouped.agg(aggfunc)
101+
agged: DataFrame = grouped.agg(aggfunc)
102102
if dropna and isinstance(agged, ABCDataFrame) and len(agged.columns):
103103
agged = agged.dropna(how="all")
104104

@@ -148,9 +148,8 @@ def pivot_table(
148148
table = table.sort_index(axis=1)
149149

150150
if fill_value is not None:
151-
filled = table.fillna(value=fill_value, downcast="infer")
152-
assert filled is not None # needed for mypy
153-
table = filled
151+
table = table.fillna(fill_value, downcast="infer") # type: ignore[assignment]
152+
assert isinstance(table, DataFrame)
154153

155154
if margins:
156155
if dropna:

0 commit comments

Comments
 (0)