We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0807828 commit bfcf579Copy full SHA for bfcf579
pandas/core/reshape/pivot.py
@@ -98,7 +98,7 @@ def pivot_table(
98
values = list(values)
99
100
grouped = data.groupby(keys, observed=observed)
101
- agged = grouped.agg(aggfunc)
+ agged: DataFrame = grouped.agg(aggfunc)
102
if dropna and isinstance(agged, ABCDataFrame) and len(agged.columns):
103
agged = agged.dropna(how="all")
104
@@ -148,9 +148,8 @@ def pivot_table(
148
table = table.sort_index(axis=1)
149
150
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
+ table = table.fillna(fill_value, downcast="infer") # type: ignore[assignment]
+ assert isinstance(table, DataFrame)
154
155
if margins:
156
if dropna:
0 commit comments