Skip to content

Commit ae1ccef

Browse files
authored
CLN: random state updates after dropping numpy 1.17 (#42407)
1 parent f8c83b6 commit ae1ccef

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

pandas/_typing.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,13 @@
120120
Frequency = Union[str, "DateOffset"]
121121
Axes = Collection[Any]
122122

123-
# BitGenerator isn't exposed until 1.18
124-
if TYPE_CHECKING:
125-
RandomState = Union[
126-
int,
127-
ArrayLike,
128-
np.random.Generator,
129-
np.random.BitGenerator,
130-
np.random.RandomState,
131-
]
123+
RandomState = Union[
124+
int,
125+
ArrayLike,
126+
np.random.Generator,
127+
np.random.BitGenerator,
128+
np.random.RandomState,
129+
]
132130

133131
# dtypes
134132
NpDtype = Union[str, np.dtype]

pandas/core/common.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
AnyArrayLike,
3333
ArrayLike,
3434
NpDtype,
35+
RandomState,
3536
Scalar,
3637
T,
3738
)
@@ -52,9 +53,6 @@
5253
from pandas.core.dtypes.missing import isna
5354

5455
if TYPE_CHECKING:
55-
# Includes BitGenerator, which only exists >= 1.18
56-
from pandas._typing import RandomState
57-
5856
from pandas import Index
5957

6058

pandas/core/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
JSONSerializable,
4848
Level,
4949
Manager,
50+
RandomState,
5051
Renamer,
5152
StorageOptions,
5253
T,
@@ -157,7 +158,6 @@
157158
if TYPE_CHECKING:
158159

159160
from pandas._libs.tslibs import BaseOffset
160-
from pandas._typing import RandomState
161161

162162
from pandas.core.frame import DataFrame
163163
from pandas.core.resample import Resampler

pandas/core/groupby/groupby.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class providing the base-class of operations.
1818
from textwrap import dedent
1919
import types
2020
from typing import (
21-
TYPE_CHECKING,
2221
Callable,
2322
Hashable,
2423
Iterable,
@@ -47,6 +46,7 @@ class providing the base-class of operations.
4746
F,
4847
FrameOrSeries,
4948
IndexLabel,
49+
RandomState,
5050
Scalar,
5151
T,
5252
final,
@@ -109,10 +109,6 @@ class providing the base-class of operations.
109109
maybe_use_numba,
110110
)
111111

112-
if TYPE_CHECKING:
113-
114-
from pandas._typing import RandomState
115-
116112
_common_see_also = """
117113
See Also
118114
--------

0 commit comments

Comments
 (0)