Skip to content

Commit 6f6586b

Browse files
authored
GH: 624 - added new is_any_real_numeric_dtype function (#715)
* added new `is_any_real_numeric_dtype` function and added `None` to `na_values` in read_csv * update added import statement in new files and deleted unimp. args * updated the file for import statement
1 parent d873a46 commit 6f6586b

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

pandas-stubs/api/types/__init__.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from pandas._libs.lib import infer_dtype as infer_dtype
22

33
from pandas.core.dtypes.api import (
4+
is_any_real_numeric_dtype as is_any_real_numeric_dtype,
45
is_array_like as is_array_like,
56
is_bool as is_bool,
67
is_bool_dtype as is_bool_dtype,

pandas-stubs/core/dtypes/api.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pandas.core.dtypes.common import (
2+
is_any_real_numeric_dtype as is_any_real_numeric_dtype,
23
is_array_like as is_array_like,
34
is_bool as is_bool,
45
is_bool_dtype as is_bool_dtype,

pandas-stubs/core/dtypes/common.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@ def is_float_dtype(arr_or_dtype: _ArrayOrDtype) -> bool: ...
5353
def is_bool_dtype(arr_or_dtype: _ArrayOrDtype) -> bool: ...
5454
def is_extension_array_dtype(arr_or_dtype: _ArrayOrDtype) -> bool: ...
5555
def is_complex_dtype(arr_or_dtype: _ArrayOrDtype) -> bool: ...
56+
def is_any_real_numeric_dtype(arr_or_dtype: _ArrayOrDtype) -> bool: ...
5657
def pandas_dtype(dtype: object) -> DtypeObj: ...

tests/test_dtypes.py

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import numpy as np
1515
import pandas as pd
16+
from pandas.api.types import is_any_real_numeric_dtype
1617
from pandas.core.arrays import BooleanArray # noqa: F401
1718
from pandas.core.arrays import IntegerArray # noqa: F401
1819
import pyarrow as pa
@@ -144,3 +145,9 @@ def test_arrow_dtype() -> None:
144145
a_dt = pd.ArrowDtype(pa.int64())
145146
check(assert_type(a_dt, pd.ArrowDtype), pd.ArrowDtype)
146147
check(assert_type(a_dt.pyarrow_dtype, pa.DataType), pa.DataType)
148+
149+
150+
def test_is_any_real_numeric_dtype() -> None:
151+
check(assert_type(is_any_real_numeric_dtype(np.array([1, 2])), bool), bool)
152+
check(assert_type(is_any_real_numeric_dtype(int), bool), bool)
153+
check(assert_type(is_any_real_numeric_dtype(float), bool), bool)

0 commit comments

Comments
 (0)