Skip to content

Commit

Permalink
FIX: Ignore typing and numba warnings in 2.0.x (#53372)
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke authored May 24, 2023
1 parent c8cd027 commit 258e55e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions doc/source/user_guide/window.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ For example, a `weighted mean <https://en.wikipedia.org/wiki/Weighted_arithmetic
be calculated with :meth:`~Rolling.apply` by specifying a separate column of weights.

.. ipython:: python
:okwarning:
def weighted_mean(x):
arr = np.ones((1, x.shape[1]))
Expand All @@ -114,6 +115,7 @@ the ``update`` argument to continue the windowing calculation.
df.ewm(0.5).mean()
.. ipython:: python
:okwarning:
online_ewm = df.head(2).ewm(0.5).online()
online_ewm.mean()
Expand Down
1 change: 1 addition & 0 deletions doc/source/whatsnew/v2.0.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Bug fixes
- Bug in :meth:`pd.array` raising for ``NumPy`` array and ``pa.large_string`` or ``pa.large_binary`` (:issue:`52590`)
- Bug in :meth:`DataFrame.__getitem__` not preserving dtypes for :class:`MultiIndex` partial keys (:issue:`51895`)
-

.. ---------------------------------------------------------------------------
.. _whatsnew_202.other:

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/_numba/kernels/mean_.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def sliding_mean(
neg_ct,
compensation_add,
num_consecutive_same_value,
prev_value,
prev_value, # pyright: ignore[reportGeneralTypeIssues]
)
else:
for j in range(start[i - 1], s):
Expand All @@ -125,7 +125,7 @@ def sliding_mean(
neg_ct,
compensation_add,
num_consecutive_same_value,
prev_value,
prev_value, # pyright: ignore[reportGeneralTypeIssues]
)

if nobs >= min_periods and nobs > 0:
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/_numba/kernels/sum_.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def sliding_sum(
sum_x,
compensation_add,
num_consecutive_same_value,
prev_value,
prev_value, # pyright: ignore[reportGeneralTypeIssues]
)
else:
for j in range(start[i - 1], s):
Expand All @@ -115,7 +115,7 @@ def sliding_sum(
sum_x,
compensation_add,
num_consecutive_same_value,
prev_value,
prev_value, # pyright: ignore[reportGeneralTypeIssues]
)

if nobs == 0 == min_periods:
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/_numba/kernels/var_.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def sliding_var(
ssqdm_x,
compensation_add,
num_consecutive_same_value,
prev_value,
prev_value, # pyright: ignore[reportGeneralTypeIssues]
)
else:
for j in range(start[i - 1], s):
Expand All @@ -135,7 +135,7 @@ def sliding_var(
ssqdm_x,
compensation_add,
num_consecutive_same_value,
prev_value,
prev_value, # pyright: ignore[reportGeneralTypeIssues]
)

if nobs >= min_periods and nobs > ddof:
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -3074,12 +3074,12 @@ def _nth(
# error: No overload variant of "where" matches argument types
# "Any", "NAType", "Any"
values = np.where(nulls, NA, grouper) # type: ignore[call-overload]
grouper = Index(values, dtype="Int64")
grouper = Index(values, dtype="Int64") # type: ignore[assignment]

else:
# create a grouper with the original parameters, but on dropped
# object
grouper, _, _ = get_grouper(
grouper, _, _ = get_grouper( # type: ignore[assignment]
dropped,
key=self.keys,
axis=self.axis,
Expand Down

0 comments on commit 258e55e

Please sign in to comment.