1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
--- python-feather-format-0.3.1+dfsg1.orig/feather/api.py
+++ python-feather-format-0.3.1+dfsg1/feather/api.py
@@ -39,9 +39,11 @@ def write_dataframe(df, path):
# TODO(wesm): pipeline conversion to Arrow memory layout
for i, name in enumerate(df.columns):
col = df.iloc[:, i]
+ if pandas.api.types.is_sparse(col):
+ col = col.sparse.to_dense()
if pdapi.is_object_dtype(col):
- inferred_type = pandas.api.types.infer_dtype(col)
+ inferred_type = pandas.api.types.infer_dtype(col, skipna=False)
msg = ("cannot serialize column {n} "
"named {name} with dtype {dtype}".format(
n=i, name=name, dtype=inferred_type))
--- python-feather-format-0.3.1+dfsg1.orig/feather/tests/test_reader.py
+++ python-feather-format-0.3.1+dfsg1/feather/tests/test_reader.py
@@ -343,8 +343,8 @@ class TestFeatherReader(unittest.TestCas
# GH #221
data = {'A': [0,1,2],
'B': [1,0,1]}
- df = pd.DataFrame(data).to_sparse(fill_value=1)
- expected = df.to_dense()
+ df = pd.DataFrame(data).astype(pd.SparseDtype(int, fill_value=1))
+ expected = df.sparse.to_dense()
self._check_pandas_roundtrip(df, expected)
def test_duplicate_columns(self):
|