Repository: arrow
Updated Branches:
  refs/heads/master dad1a8ee3 -> 09e6eade1


ARROW-836: add test for pandas conversion of timedelta, currently unimplemented

xref https://github.com/pandas-dev/pandas/pull/16004

Author: Jeff Reback <jeff.reb...@twosigma.com>

Closes #551 from jreback/timedelta and squashes the following commits:

cfd310e [Jeff Reback] TST: add test for pandas conversion of timedelta, 
currently unimplemented


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/09e6eade
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/09e6eade
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/09e6eade

Branch: refs/heads/master
Commit: 09e6eade166b60db95694d291ebfb074f1442ff8
Parents: dad1a8e
Author: Jeff Reback <jeff.reb...@twosigma.com>
Authored: Sun Apr 16 13:11:38 2017 -0400
Committer: Wes McKinney <wes.mckin...@twosigma.com>
Committed: Sun Apr 16 13:11:38 2017 -0400

----------------------------------------------------------------------
 python/pyarrow/tests/test_convert_pandas.py | 13 +++++++++++++
 python/pyarrow/tests/test_feather.py        | 10 ++++++++++
 2 files changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/09e6eade/python/pyarrow/tests/test_convert_pandas.py
----------------------------------------------------------------------
diff --git a/python/pyarrow/tests/test_convert_pandas.py 
b/python/pyarrow/tests/test_convert_pandas.py
index 4a57e4b..2394d63 100644
--- a/python/pyarrow/tests/test_convert_pandas.py
+++ b/python/pyarrow/tests/test_convert_pandas.py
@@ -18,6 +18,7 @@
 
 from collections import OrderedDict
 
+import pytest
 import datetime
 import unittest
 import decimal
@@ -412,6 +413,18 @@ class TestPandasConversion(unittest.TestCase):
         assert a1[0].as_py() == expected
         assert a2[0].as_py() == expected
 
+    @pytest.mark.xfail(reason="not supported ATM",
+                       raises=NotImplementedError)
+    def test_timedelta(self):
+        # TODO(jreback): Pandas only support ns resolution
+        # Arrow supports ??? for resolution
+        df = pd.DataFrame({
+            'timedelta': np.arange(start=0, stop=3*86400000,
+                                   step=86400000,
+                                   dtype='timedelta64[ms]')
+            })
+        pa.Table.from_pandas(df)
+
     def test_column_of_arrays(self):
         df, schema = dataframe_with_arrays()
         self._check_pandas_roundtrip(df, schema=schema, expected_schema=schema)

http://git-wip-us.apache.org/repos/asf/arrow/blob/09e6eade/python/pyarrow/tests/test_feather.py
----------------------------------------------------------------------
diff --git a/python/pyarrow/tests/test_feather.py 
b/python/pyarrow/tests/test_feather.py
index 6f8040f..ef73a8f 100644
--- a/python/pyarrow/tests/test_feather.py
+++ b/python/pyarrow/tests/test_feather.py
@@ -14,6 +14,7 @@
 
 import os
 import unittest
+import pytest
 
 from numpy.testing import assert_array_equal
 import numpy as np
@@ -320,6 +321,15 @@ class TestFeatherReader(unittest.TestCase):
 
         self._check_pandas_roundtrip(df, null_counts=[1, 1])
 
+    @pytest.mark.xfail(reason="not supported ATM",
+                       raises=NotImplementedError)
+    def test_timedelta_with_nulls(self):
+        df = pd.DataFrame({'test': [pd.Timedelta('1 day'),
+                                    None,
+                                    pd.Timedelta('3 day')]})
+
+        self._check_pandas_roundtrip(df, null_counts=[1, 1])
+
     def test_out_of_float64_timestamp_with_nulls(self):
         df = pd.DataFrame(
             {'test': pd.DatetimeIndex([1451606400000000001,

Reply via email to