Skip to content

Commit 658199d

Browse files
authored
Address libaggregations FIXME (#44635)
1 parent 15d26a1 commit 658199d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pandas/_libs/window/aggregations.pyi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ from typing import (
66

77
import numpy as np
88

9-
from pandas._typing import WindowingRankType
9+
from pandas._typing import (
10+
WindowingRankType,
11+
npt,
12+
)
1013

1114
def roll_sum(
1215
values: np.ndarray, # const float64_t[:]
@@ -83,7 +86,7 @@ def roll_apply(
8386
raw: bool,
8487
args: tuple[Any, ...],
8588
kwargs: dict[str, Any],
86-
) -> np.ndarray: ... # np.ndarray[float] # FIXME: could also be type(obj) if n==0
89+
) -> npt.NDArray[np.float64]: ...
8790
def roll_weighted_sum(
8891
values: np.ndarray, # const float64_t[:]
8992
weights: np.ndarray, # const float64_t[:]

pandas/_libs/window/aggregations.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ def roll_apply(object obj,
12711271
Py_ssize_t i, s, e, N = len(start), n = len(obj)
12721272

12731273
if n == 0:
1274-
return obj
1274+
return np.array([], dtype=np.float64)
12751275

12761276
arr = np.asarray(obj)
12771277

0 commit comments

Comments
 (0)