Skip to content

Commit c09bdb9

Browse files
zhengruifengdongjoon-hyun
authored andcommitted
[SPARK-54650][PYTHON][FOLLOW-UP] Apply pandas.api.types.is_integer_dtype to check the series dtype
### What changes were proposed in this pull request? Apply `pandas.api.types.is_integer_dtype` to check the series dtype ### Why are the changes needed? `pandas.api.types.is_integer_dtype` is a public pandas API, which is the standard way to check the dtype ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? ci ### Was this patch authored or co-authored using generative AI tooling? no Closes #53416 from zhengruifeng/apply_stand_is_integer_dtype. Authored-by: Ruifeng Zheng <ruifengz@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
1 parent dc47def commit c09bdb9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/pyspark/sql/pandas/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ def correct_timestamp(pser: pd.Series) -> pd.Series:
12771277
# lambda x: Decimal(x))).cast(pa.decimal128(1))
12781278

12791279
def convert_int_to_decimal(pser: pd.Series) -> pd.Series:
1280-
if pser.dtype.kind in ["i", "u"]:
1280+
if pd.api.types.is_integer_dtype(pser): # type: ignore[attr-defined]
12811281
return pser.apply( # type: ignore[return-value]
12821282
lambda x: Decimal(x) if pd.notna(x) else None
12831283
)

0 commit comments

Comments
 (0)