Skip to content

Commit

Permalink
BUG: dateutil.tz.tzoffset tzname formatting fails with dateutil 2.1. c…
Browse files Browse the repository at this point in the history
…lose #2443
  • Loading branch information
wesm committed Dec 7, 2012
1 parent c3e75db commit 7461b45
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 4 additions & 2 deletions RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ pandas 0.10.0
`reset_printoptions` (#2393)

**Experimental Features**

- Add support for Panel4D, a named 4 Dimensional stucture
- Add support for ndpanel factory functions, to create custom, domain-specific
N Dimensional containers
- Add support for ndpanel factory functions, to create custom,
domain-specific N-Dimensional containers

**API Changes**

Expand Down Expand Up @@ -135,6 +136,7 @@ pandas 0.10.0
- Fixed issued with duplicate keys in an index (#2347, #2380)
- Fixed issues related to Hash randomization, on by default starting with 3.3 (#2331)
- Fixed issue with missing attributes after loading a pickled dataframe (#2431)
- Fix Timestamp formatting with tzoffset time zone in dateutil 2.1 (#2443)

pandas 0.9.1
============
Expand Down
4 changes: 4 additions & 0 deletions pandas/tseries/tests/test_timezones.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,10 @@ def test_dateutil_tzoffset_support(self):

self.assertEquals(series.index.tz, tzinfo)

# it works! #2443
repr(series.index[0])


class TestTimeZones(unittest.TestCase):
_multiprocess_can_split_ = True
def setUp(self):
Expand Down
9 changes: 7 additions & 2 deletions pandas/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ class Timestamp(_Timestamp):
result += self.strftime('%z')
if self.tzinfo:
zone = _get_zone(self.tzinfo)
result += self.strftime(' %%Z, tz=%s' % zone)
result += _tz_format(self, zone)
except ValueError:
year2000 = self.replace(year=2000)
result += year2000.strftime('%z')
if self.tzinfo:
zone = _get_zone(self.tzinfo)
result += year2000.strftime(' %%Z, tz=%s' % zone)
result += _tz_format(year2000, zone)

return '<Timestamp: %s>' % result

Expand Down Expand Up @@ -302,6 +302,11 @@ NaT = NaTType()

iNaT = util.get_nat()

cdef _tz_format(object obj, object zone):
try:
return obj.strftime(' %%Z, tz=%s' % zone)
except:
return ', tz=%s' % zone

def is_timestamp_array(ndarray[object] values):
cdef int i, n = len(values)
Expand Down

0 comments on commit 7461b45

Please sign in to comment.