ARROW-6556: [Python] Fix warning for pandas SparseDataFrame removal

This commit is contained in:
Joris Van den Bossche committed 2019-09-19 12:35:38 +02:00
1 parent 606af08a3e
commit 06a0738066
3 files changed
+7 -5

No files matched your search

+3 -4
View File
@@ -82,11 +82,10 @@ cdef class _PandasAPIShim(object):
self._datetimetz_type = DatetimeTZDtype
self._have_pandas = True
try:
from pandas import SparseDataFrame
self.has_sparse = True
except ImportError:
if self._loose_version > LooseVersion('0.25'):
self.has_sparse = False
else:
self.has_sparse = True
cdef inline _check_import(self, bint raise_=True):
if self._tried_importing_pandas:
+2 -1
View File
@@ -34,6 +34,7 @@ from pyarrow.lib import FeatherWriter
try:
from pandas.util.testing import assert_frame_equal
import pandas as pd
import pyarrow.pandas_compat
except ImportError:
pass
@@ -518,7 +519,7 @@ class TestFeatherReader(unittest.TestCase):
@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
@pytest.mark.filterwarnings("ignore:DataFrame.to_sparse:FutureWarning")
def test_sparse_dataframe(self):
if not hasattr(pd, 'SparseDataFrame'):
if not pa.pandas_compat._pandas_api.has_sparse:
pytest.skip("version of pandas does not support SparseDataFrame")
# GH #221
data = {'A': [0, 1, 2],
+2
View File
@@ -26,3 +26,5 @@ build-dir = doc/_build
[tool:pytest]
addopts = --ignore=scripts
filterwarnings =
error:The SparseDataFrame:FutureWarning