[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help needed for pandas bug: Could anybody verify the suspicion that tzdata might have some influence?



On Sun, 02 Apr 2017, Andreas Tille wrote:

> Hi Yaroslav,

> On Tue, Mar 28, 2017 at 11:52:43AM -0400, Yaroslav Halchenko wrote:

> > > I have filed another bug for that (#858881); it would be nice if that
> > > could be fixed as well.

> > what matters ATM is that it (package) built fine 
> > https://buildd.debian.org/status/logs.php?pkg=pandas&ver=0.19.2-5&arch=amd64

> Rebecca N. Palmer has kindly provided a patch that fits the discussion
> inside the bug (thanks a lot Rebecca).  It worked for me and thus I
> uploaded (having a pristine-tar branch in Git would have been convient).

> Yaroslav, would you mind forwarding the patch upstream?

seems was already applied just few days back:

commit b6d405d695249980aa2f93d58998412b4b81dcf3
Author: Jeff Reback <jeff@reback.net>
Date:   Thu Mar 30 16:42:23 2017 -0400

    TST: incorrect localization in append testing
    
    and when ``pytz`` version changes our tests break because of this
    incorrect (old) method, which works when you *dont'* have a tz change,
    but fails when the tz's actually change.
    
    Author: Jeff Reback <jeff@reback.net>
    
    Closes #15849 from jreback/localize and squashes the following commits:
    
    d43d088 [Jeff Reback] TST: incorrect localization in append testing

diff --git a/pandas/tests/test_multilevel.py b/pandas/tests/test_multilevel.py
index fd5421abc..5584c1ac6 100755
--- a/pandas/tests/test_multilevel.py
+++ b/pandas/tests/test_multilevel.py
@@ -83,9 +83,9 @@ class TestMultiLevel(Base, tm.TestCase):
         # GH 7112
         import pytz
         tz = pytz.timezone('Asia/Tokyo')
-        expected_tuples = [(1.1, datetime.datetime(2011, 1, 1, tzinfo=tz)),
-                           (1.2, datetime.datetime(2011, 1, 2, tzinfo=tz)),
-                           (1.3, datetime.datetime(2011, 1, 3, tzinfo=tz))]
+        expected_tuples = [(1.1, tz.localize(datetime.datetime(2011, 1, 1))),
+                           (1.2, tz.localize(datetime.datetime(2011, 1, 2))),
+                           (1.3, tz.localize(datetime.datetime(2011, 1, 3)))]
         expected = Index([1.1, 1.2, 1.3] + expected_tuples)
         tm.assert_index_equal(result, expected)
 
@@ -103,9 +103,9 @@ class TestMultiLevel(Base, tm.TestCase):
 
         result = midx_lv3.append(midx_lv2)
         expected = Index._simple_new(
-            np.array([(1.1, datetime.datetime(2011, 1, 1, tzinfo=tz), 'A'),
-                      (1.2, datetime.datetime(2011, 1, 2, tzinfo=tz), 'B'),
-                      (1.3, datetime.datetime(2011, 1, 3, tzinfo=tz), 'C')] +
+            np.array([(1.1, tz.localize(datetime.datetime(2011, 1, 1)), 'A'),
+                      (1.2, tz.localize(datetime.datetime(2011, 1, 2)), 'B'),
+                      (1.3, tz.localize(datetime.datetime(2011, 1, 3)), 'C')] +
                      expected_tuples), None)
         tm.assert_index_equal(result, expected)
 



-- 
Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        


Reply to: