This is an automated email from the ASF dual-hosted git repository.
alenka pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new de6c3cd2b6 GH-35329: [Python] Address pandas.types.is_sparse
deprecation (#35366)
de6c3cd2b6 is described below
commit de6c3cd2b6048641251fac0c64b70c2cd166e0c9
Author: Matthew Roeschke <[email protected]>
AuthorDate: Mon May 8 21:09:48 2023 -0700
GH-35329: [Python] Address pandas.types.is_sparse deprecation (#35366)
### Rationale for this change
pandas is deprecating `pandas.types.is_sparse` in 2.1
### What changes are included in this PR?
Changing usages of `is_sparse` to the recommended migration
`isinstance(dtype, pd.SparseDtype)`
### Are these changes tested?
### Are there any user-facing changes?
No
closes https://github.com/apache/arrow/issues/35329
* Closes: #35329
Authored-by: Matthew Roeschke <[email protected]>
Signed-off-by: Alenka Frim <[email protected]>
---
python/pyarrow/pandas-shim.pxi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/pyarrow/pandas-shim.pxi b/python/pyarrow/pandas-shim.pxi
index 4f96943e1b..f7e0ceccbd 100644
--- a/python/pyarrow/pandas-shim.pxi
+++ b/python/pyarrow/pandas-shim.pxi
@@ -190,7 +190,7 @@ cdef class _PandasAPIShim(object):
cpdef is_sparse(self, obj):
if self._have_pandas_internal():
- return self._types_api.is_sparse(obj)
+ return isinstance(obj.dtype, self.pd.SparseDtype)
else:
return False