Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pandas-stubs/_typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ from re import Pattern
import sys
from typing import (
Any,
Generic,
Literal,
Protocol,
SupportsIndex,
Expand All @@ -37,6 +38,7 @@ from typing_extensions import (
ParamSpec,
TypeAlias,
TypeVar,
override,
)

from pandas._libs.interval import Interval
Expand Down Expand Up @@ -818,6 +820,8 @@ np_ndarray_float: TypeAlias = npt.NDArray[np.floating]
np_ndarray_complex: TypeAlias = npt.NDArray[np.complexfloating]
np_ndarray_bool: TypeAlias = npt.NDArray[np.bool_]
np_ndarray_str: TypeAlias = npt.NDArray[np.str_]
np_ndarray_dt: TypeAlias = npt.NDArray[np.datetime64]
np_ndarray_td: TypeAlias = npt.NDArray[np.timedelta64]

# Define shape and generic type variables with defaults similar to numpy
GenericT = TypeVar("GenericT", bound=np.generic, default=Any)
Expand Down Expand Up @@ -1055,4 +1059,14 @@ DictConvertible: TypeAlias = FulldatetimeDict | DataFrame
# where it is the only acceptable type.
Incomplete: TypeAlias = Any

# differentiating between bool and int/float/complex
# https://github.com/pandas-dev/pandas-stubs/pull/1312#pullrequestreview-3126128971
class Just(Protocol, Generic[T]):
@property # type: ignore[override]
@override
def __class__(self, /) -> type[T]: ...
@__class__.setter
@override
def __class__(self, t: type[T], /) -> None: ...

__all__ = ["npt", "type_t"]
6 changes: 3 additions & 3 deletions pandas-stubs/core/groupby/groupby.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ from pandas._typing import (
from pandas.plotting import PlotAccessor

_ResamplerGroupBy: TypeAlias = (
DatetimeIndexResamplerGroupby[NDFrameT]
| PeriodIndexResamplerGroupby[NDFrameT]
| TimedeltaIndexResamplerGroupby[NDFrameT]
DatetimeIndexResamplerGroupby[NDFrameT] # ty: ignore[invalid-argument-type]
| PeriodIndexResamplerGroupby[NDFrameT] # ty: ignore[invalid-argument-type]
| TimedeltaIndexResamplerGroupby[NDFrameT] # ty: ignore[invalid-argument-type]
)

class GroupBy(BaseGroupBy[NDFrameT]):
Expand Down
Loading
Loading