diff --git a/pandas/_typing.py b/pandas/_typing.py index d677564b5455e..588aa00116231 100644 --- a/pandas/_typing.py +++ b/pandas/_typing.py @@ -120,15 +120,13 @@ Frequency = Union[str, "DateOffset"] Axes = Collection[Any] -# BitGenerator isn't exposed until 1.18 -if TYPE_CHECKING: - RandomState = Union[ - int, - ArrayLike, - np.random.Generator, - np.random.BitGenerator, - np.random.RandomState, - ] +RandomState = Union[ + int, + ArrayLike, + np.random.Generator, + np.random.BitGenerator, + np.random.RandomState, +] # dtypes NpDtype = Union[str, np.dtype] diff --git a/pandas/core/common.py b/pandas/core/common.py index 922959938b944..37674cdb34aec 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -32,6 +32,7 @@ AnyArrayLike, ArrayLike, NpDtype, + RandomState, Scalar, T, ) @@ -52,9 +53,6 @@ from pandas.core.dtypes.missing import isna if TYPE_CHECKING: - # Includes BitGenerator, which only exists >= 1.18 - from pandas._typing import RandomState - from pandas import Index diff --git a/pandas/core/generic.py b/pandas/core/generic.py index f1a5a565fc861..1fc42a60f3d88 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -47,6 +47,7 @@ JSONSerializable, Level, Manager, + RandomState, Renamer, StorageOptions, T, @@ -157,7 +158,6 @@ if TYPE_CHECKING: from pandas._libs.tslibs import BaseOffset - from pandas._typing import RandomState from pandas.core.frame import DataFrame from pandas.core.resample import Resampler diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index ba80f7329202d..5f462de19a398 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -18,7 +18,6 @@ class providing the base-class of operations. from textwrap import dedent import types from typing import ( - TYPE_CHECKING, Callable, Hashable, Iterable, @@ -47,6 +46,7 @@ class providing the base-class of operations. F, FrameOrSeries, IndexLabel, + RandomState, Scalar, T, final, @@ -109,10 +109,6 @@ class providing the base-class of operations. maybe_use_numba, ) -if TYPE_CHECKING: - - from pandas._typing import RandomState - _common_see_also = """ See Also --------