Skip to content

Commit 0ce64e0

Browse files
committed
ENH: Use version checks from dedicated utils
1 parent 4362824 commit 0ce64e0

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

pandas/core/common.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
from pandas._libs import lib
3535

36+
from pandas.compat.numpy import np_version_gte1p24
3637
from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
3738
from pandas.core.dtypes.common import (
3839
is_bool_dtype,
@@ -45,8 +46,6 @@
4546
)
4647
from pandas.core.dtypes.inference import iterable_not_string
4748

48-
from pandas.util.version import Version
49-
5049
if TYPE_CHECKING:
5150
from pandas._typing import (
5251
AnyArrayLike,
@@ -238,7 +237,7 @@ def asarray_tuplesafe(values: Iterable, dtype: NpDtype | None = None) -> ArrayLi
238237
try:
239238
with warnings.catch_warnings():
240239
# Can remove warning filter once NumPy 1.24 is min version
241-
if Version(np.__version__) < Version("1.24.0"):
240+
if not np_version_gte1p24:
242241
warnings.simplefilter("ignore", np.VisibleDeprecationWarning)
243242
result = np.asarray(values, dtype=dtype)
244243
except ValueError:

pandas/tests/indexes/test_common.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import pytest
1414

1515
from pandas.compat import IS64
16+
from pandas.compat.numpy import np_version_gte1p25
1617

1718
from pandas.core.dtypes.common import (
1819
is_integer_dtype,
@@ -27,7 +28,6 @@
2728
RangeIndex,
2829
)
2930
import pandas._testing as tm
30-
from pandas.util.version import Version
3131

3232

3333
class TestCommon:
@@ -390,7 +390,7 @@ def test_astype_preserves_name(self, index, dtype):
390390
warn = None
391391
if index.dtype.kind == "c" and dtype in ["float64", "int64", "uint64"]:
392392
# imaginary components discarded
393-
if Version(np.__version__) >= Version("1.25.0"):
393+
if np_version_gte1p25:
394394
warn = np.exceptions.ComplexWarning
395395
else:
396396
warn = np.ComplexWarning

0 commit comments

Comments
 (0)