@@ -2067,6 +2067,10 @@ def test_append_with_timezones_dateutil(self):
20672067 except ImportError :
20682068 raise nose .SkipTest
20692069
2070+ # use maybe_get_tz instead of dateutil.tz.gettz to handle the windows filename issues.
2071+ from pandas .tslib import maybe_get_tz
2072+ gettz = lambda x : maybe_get_tz ('dateutil/' + x )
2073+
20702074 def compare (a , b ):
20712075 tm .assert_frame_equal (a , b )
20722076
@@ -2082,7 +2086,7 @@ def compare(a, b):
20822086 with ensure_clean_store (self .path ) as store :
20832087
20842088 _maybe_remove (store , 'df_tz' )
2085- df = DataFrame (dict (A = [ Timestamp ('20130102 2:00:00' , tz = dateutil . tz . gettz ('US/Eastern' )) + timedelta (hours = 1 ) * i for i in range (5 ) ]))
2089+ df = DataFrame (dict (A = [ Timestamp ('20130102 2:00:00' , tz = gettz ('US/Eastern' )) + timedelta (hours = 1 ) * i for i in range (5 ) ]))
20862090 store .append ('df_tz' , df , data_columns = ['A' ])
20872091 result = store ['df_tz' ]
20882092 compare (result , df )
@@ -2093,14 +2097,14 @@ def compare(a, b):
20932097
20942098 _maybe_remove (store , 'df_tz' )
20952099 # ensure we include dates in DST and STD time here.
2096- df = DataFrame (dict (A = Timestamp ('20130102' , tz = dateutil . tz . gettz ('US/Eastern' )), B = Timestamp ('20130603' , tz = dateutil . tz . gettz ('US/Eastern' ))), index = range (5 ))
2100+ df = DataFrame (dict (A = Timestamp ('20130102' , tz = gettz ('US/Eastern' )), B = Timestamp ('20130603' , tz = gettz ('US/Eastern' ))), index = range (5 ))
20972101 store .append ('df_tz' , df )
20982102 result = store ['df_tz' ]
20992103 compare (result , df )
21002104 assert_frame_equal (result , df )
21012105
21022106 _maybe_remove (store , 'df_tz' )
2103- df = DataFrame (dict (A = Timestamp ('20130102' , tz = dateutil . tz . gettz ('US/Eastern' )), B = Timestamp ('20130102' , tz = dateutil . tz . gettz ('EET' ))), index = range (5 ))
2107+ df = DataFrame (dict (A = Timestamp ('20130102' , tz = gettz ('US/Eastern' )), B = Timestamp ('20130102' , tz = gettz ('EET' ))), index = range (5 ))
21042108 self .assertRaises (TypeError , store .append , 'df_tz' , df )
21052109
21062110 # this is ok
@@ -2111,14 +2115,14 @@ def compare(a, b):
21112115 assert_frame_equal (result , df )
21122116
21132117 # can't append with diff timezone
2114- df = DataFrame (dict (A = Timestamp ('20130102' , tz = dateutil . tz . gettz ('US/Eastern' )), B = Timestamp ('20130102' , tz = dateutil . tz . gettz ('CET' ))), index = range (5 ))
2118+ df = DataFrame (dict (A = Timestamp ('20130102' , tz = gettz ('US/Eastern' )), B = Timestamp ('20130102' , tz = gettz ('CET' ))), index = range (5 ))
21152119 self .assertRaises (ValueError , store .append , 'df_tz' , df )
21162120
21172121 # as index
21182122 with ensure_clean_store (self .path ) as store :
21192123
21202124 # GH 4098 example
2121- df = DataFrame (dict (A = Series (lrange (3 ), index = date_range ('2000-1-1' , periods = 3 , freq = 'H' , tz = dateutil . tz . gettz ('US/Eastern' )))))
2125+ df = DataFrame (dict (A = Series (lrange (3 ), index = date_range ('2000-1-1' , periods = 3 , freq = 'H' , tz = gettz ('US/Eastern' )))))
21222126
21232127 _maybe_remove (store , 'df' )
21242128 store .put ('df' , df )
0 commit comments