Skip to content

One more "'tzoffset' object has no attribute 'zone' " #1928

@bf0

Description

@bf0

Version: 0.9.0.dev_de31cbe (py2.7-macosx-10.6-x86_64)

Related to #1922 (closed)

I could be the only dummy with this kind of data so I might be able to find a few more of these.
Although I think these are typical Postgres tz-aware timestamps.

Repro

from StringIO import StringIO
table="""ts, d1
2012-05-23 10:00:01.123000-07:00,  3.1459265
2012-05-23 10:00:02.456000-07:00,  2.7182818
"""
df = pd.read_table(StringIO(table), parse_dates=True, index_col='ts', sep=',')
df.resample('t')

Traceback

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-90-a0ce8072eb5a> in <module>()
----> 1 df.resample('t')

   pandas/core/generic.pyc in resample(self, rule, how, axis, fill_method, closed, label, convention, kind, loffset, limit, base)
    187                               fill_method=fill_method, convention=convention,
    188                               limit=limit, base=base)
--> 189         return sampler.resample(self)
    190 
    191     def first(self, offset):

   pandas/tseries/resample.pyc in resample(self, obj)
     66 
     67         if isinstance(axis, DatetimeIndex):
---> 68             rs = self._resample_timestamps(obj)
     69         elif isinstance(axis, PeriodIndex):
     70             offset = to_offset(self.freq)

   pandas/tseries/resample.pyc in _resample_timestamps(self, obj)
    180         axlabels = obj._get_axis(self.axis)
    181 
--> 182         binner, grouper = self._get_time_grouper(obj)
    183 
    184         # Determine if we're downsampling

   pandas/tseries/resample.pyc in _get_time_grouper(self, obj)
     95 
     96         if self.kind is None or self.kind == 'timestamp':
---> 97             binner, bins, binlabels = self._get_time_bins(axis)
     98         else:
     99             binner, bins, binlabels = self._get_time_period_bins(axis)

   pandas/tseries/resample.pyc in _get_time_bins(self, axis)
    111         first, last = _get_range_edges(axis, self.freq, closed=self.closed,
    112                                        base=self.base)
--> 113         binner = labels = DatetimeIndex(freq=self.freq, start=first, end=last)
    114 
    115         # a little hack

   pandas/tseries/index.pyc in __new__(cls, data, freq, start, end, periods, copy, name, tz, verify_integrity, normalize, **kwds)
    175         if data is None:
    176             return cls._generate(start, end, periods, name, offset,
--> 177                                  tz=tz, normalize=normalize)
    178 
    179         if not isinstance(data, np.ndarray):

   pandas/tseries/index.pyc in _generate(cls, start, end, periods, name, offset, tz, normalize)
    282             end = Timestamp(end)
    283 
--> 284         inferred_tz = tools._infer_tzinfo(start, end)
    285 
    286         if tz is not None and inferred_tz is not None:

   pandas/tseries/tools.pyc in _infer_tzinfo(start, end)
     31     tz = None
     32     if start is not None:
---> 33         tz = _infer(start, end)
     34     elif end is not None:
     35         tz = _infer(end, start)

   pandas/tseries/tools.pyc in _infer(a, b)
     27         tz = a.tzinfo
     28         if b and b.tzinfo:
---> 29             assert(tz.zone == b.tzinfo.zone)
     30         return tz
     31     tz = None

AttributeError: 'tzoffset' object has no attribute 'zone'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions