-
-
Notifications
You must be signed in to change notification settings - Fork 169
MNT: Add more defaults to the stubs #1728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ from pandas._libs.tslibs.offsets import DateOffset | |
| from pandas._libs.tslibs.timedeltas import Timedelta | ||
| from pandas._typing import ( | ||
| AnyArrayLike, | ||
| AxisInt, | ||
| DtypeArg, | ||
| Frequency, | ||
| NpDtype, | ||
|
|
@@ -34,37 +35,27 @@ class TimedeltaArray(TimelikeOps): | |
| freq: Frequency | None = None, | ||
| copy: bool = ..., | ||
| ) -> None: ... | ||
| # TODO: pandas-dev/pandas-stubs#1589 add testing to figure out the correct types | ||
| # def sum( | ||
| # self, | ||
| # *, | ||
| # axis=..., | ||
| # dtype=..., | ||
| # out=..., | ||
| # keepdims: bool = ..., | ||
| # initial=..., | ||
| # skipna: bool = ..., | ||
| # min_count: int = ..., | ||
| # ): ... | ||
| # def std( | ||
| # self, | ||
| # *, | ||
| # axis=..., | ||
| # dtype=..., | ||
| # out=..., | ||
| # ddof: int = ..., | ||
| # keepdims: bool = ..., | ||
| # skipna: bool = ..., | ||
| # ): ... | ||
| # def median( | ||
| # self, | ||
| # *, | ||
| # axis=..., | ||
| # out=..., | ||
| # overwrite_input: bool = ..., | ||
| # keepdims: bool = ..., | ||
| # skipna: bool = ..., | ||
| # ): ... | ||
| def sum( | ||
| self, | ||
| *, | ||
| axis: AxisInt | None = None, | ||
| dtype: NpDtype | None = None, | ||
| out: np_1darray_object | None = None, | ||
| keepdims: bool = False, | ||
| initial: object | None = None, | ||
| skipna: bool = True, | ||
| min_count: int = 0, | ||
| ) -> Timedelta: ... | ||
| def std( | ||
| self, | ||
| *, | ||
| axis: AxisInt | None = None, | ||
| dtype: DtypeArg | None = None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These reduction methods ( Ground Truth: core/arrays/timedeltas.py#L367 (via Gemini 3 created, I verified
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should return |
||
| out: np_1darray_object | None = None, | ||
| ddof: int = 1, | ||
| keepdims: bool = False, | ||
| skipna: bool = True, | ||
| ) -> Timedelta: ... | ||
| def __mul__(self, other: Any) -> Self: ... | ||
| __rmul__ = __mul__ | ||
| @overload | ||
|
|
@@ -123,7 +114,7 @@ class TimedeltaArray(TimelikeOps): | |
| def min(self, *, skipna: bool = True, **kwargs: Any) -> Timedelta | NaTType: ... | ||
| def max(self, *, skipna: bool = True, **kwargs: Any) -> Timedelta | NaTType: ... | ||
| def mean(self, *, skipna: bool = True, **kwargs: Any) -> Timedelta | NaTType: ... | ||
| def median(self, *, skipna: bool = True, **kwargs: Any) -> Timedelta | NaTType: ... | ||
| def median(self, *, skipna: bool = True, **kwargs: Any) -> Timedelta: ... | ||
| def __array__( | ||
| self, dtype: NpDtype | None = None, copy: bool | None = None | ||
| ) -> np_1darray_td: ... | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
Timedelta.__new__, theunitparameter actually defaults toNoneat runtime, although the docstring mentions"ns". UsingNoneallows the constructor to handle input resolution correctly.Ground Truth: timedeltas.pyx#L2147
Gemini 3 created, I verified