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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
Description: Adapt to Pandas 2.0
Bug-Debian: https://bugs.debian.org/1044071
Author: Andreas Tille <tille@debian.org>, Rebecca N. Palmer <rebecca_palmer@zoho.com>
--- a/feather/ext.pyx
+++ b/feather/ext.pyx
@@ -139,7 +139,7 @@ cdef class FeatherWriter:
if tz is None:
metadata.timezone = b''
else:
- metadata.timezone = tobytes(tz.zone)
+ metadata.timezone = tobytes(str(tz))
check_status(self.writer.get().AppendTimestamp(c_name, values,
metadata))
--- a/feather/api.py
+++ b/feather/api.py
@@ -29,9 +29,6 @@ def write_dataframe(df, path):
'''
writer = ext.FeatherWriter(path)
- if isinstance(df, pd.SparseDataFrame):
- df = df.to_dense()
-
if not df.columns.is_unique:
raise ValueError("cannot serialize duplicate column names")
--- a/feather/tests/test_reader.py
+++ b/feather/tests/test_reader.py
@@ -18,7 +18,8 @@ import unittest
from numpy.testing import assert_array_equal
import numpy as np
-from pandas.util.testing import assert_frame_equal
+from pandas.testing import assert_frame_equal
+import datetime
import pandas as pd
from feather.compat import guid
@@ -294,7 +295,7 @@ class TestFeatherReader(unittest.TestCase):
self._check_pandas_roundtrip(df)
def test_timestamp_with_nulls(self):
- df = pd.DataFrame({'test': [pd.datetime(2016,1,1),None,pd.datetime(2016,1,3)]})
+ df = pd.DataFrame({'test': [datetime.datetime(2016,1,1),None,datetime.datetime(2016,1,3)]})
df['with_tz'] = df.test.dt.tz_localize('utc')
self._check_pandas_roundtrip(df, null_counts=[1,1])
|