You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passing a string column with timestamps like "2012-04-23 10:00:23.123000-07:00" (fixed offset timezone) to DataFrame.set_index() , getting exception:
AttributeError: 'FixedOffsetTimezone' object has no attribute 'zone'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-d8465aa13e80> in <module>()
----> 1 df.set_index('ts')
/Users/redacted/.pythonbrew/venvs/Python-2.7.3/redacted/lib/python2.7/site-packages/pandas-0.9.0.dev_e98a568-py2.7-macosx-10.6-x86_64.egg/pandas/core/frame.pyc in set_index(self, keys, drop, append, inplace, verify_integrity)
2422 arrays.append(level)
2423
-> 2424 index = MultiIndex.from_arrays(arrays, names=names)
2425
2426 if verify_integrity and not index.is_unique:
/Users/redacted/.pythonbrew/venvs/Python-2.7.3/redacted/lib/python2.7/site-packages/pandas-0.9.0.dev_e98a568-py2.7-macosx-10.6-x86_64.egg/pandas/core/index.pyc in from_arrays(cls, arrays, sortorder, names)
1551 if len(arrays) == 1:
1552 name = None if names is None else names[0]
-> 1553 return Index(arrays[0], name=name)
1554
1555 cats = [Categorical.from_array(arr) for arr in arrays]
/Users/redacted/.pythonbrew/venvs/Python-2.7.3/redacted/lib/python2.7/site-packages/pandas-0.9.0.dev_e98a568-py2.7-macosx-10.6-x86_64.egg/pandas/core/index.pyc in __new__(cls, data, dtype, copy, name)
109 if _shouldbe_timestamp(subarr):
110 from pandas.tseries.index import DatetimeIndex
--> 111 return DatetimeIndex(subarr, copy=copy, name=name)
112
113 if lib.is_period_array(subarr):
/Users/redacted/.pythonbrew/venvs/Python-2.7.3/redacted/lib/python2.7/site-packages/pandas-0.9.0.dev_e98a568-py2.7-macosx-10.6-x86_64.egg/pandas/tseries/index.pyc in __new__(cls, data, freq, start, end, periods, copy, name, tz, verify_integrity, normalize, **kwds)
228 else:
229 try:
--> 230 subarr = tools.to_datetime(data)
231 except ValueError:
232 # tz aware
/Users/redacted/.pythonbrew/venvs/Python-2.7.3/redacted/lib/python2.7/site-packages/pandas-0.9.0.dev_e98a568-py2.7-macosx-10.6-x86_64.egg/pandas/tseries/tools.pyc in to_datetime(arg, errors, dayfirst, utc, box)
90 if isinstance(arg, list):
91 arg = np.array(arg, dtype='O')
---> 92 result = _convert_f(arg)
93 return result
94 try:
/Users/redacted/.pythonbrew/venvs/Python-2.7.3/redacted/lib/python2.7/site-packages/pandas-0.9.0.dev_e98a568-py2.7-macosx-10.6-x86_64.egg/pandas/tseries/tools.pyc in _convert_f(arg)
75 except ValueError, e:
76 try:
---> 77 values, tz = lib.datetime_to_datetime64(arg)
78 return DatetimeIndex._simple_new(values, None, tz=tz)
79 except (ValueError, TypeError):
/Users/redacted/.pythonbrew/venvs/Python-2.7.3/redacted/lib/python2.7/site-packages/pandas-0.9.0.dev_e98a568-py2.7-macosx-10.6-x86_64.egg/pandas/lib.so in pandas.lib.datetime_to_datetime64 (pandas/src/tseries.c:38359)()
/Users/redacted/.pythonbrew/venvs/Python-2.7.3/redacted/lib/python2.7/site-packages/pandas-0.9.0.dev_e98a568-py2.7-macosx-10.6-x86_64.egg/pandas/lib.so in pandas.lib._get_zone (pandas/src/tseries.c:37262)()
AttributeError: 'FixedOffsetTimezone' object has no attribute 'zone'
As an aside, I believe this is a common tz-aware timestamp for Postgres, so encountering this with:
Version: 0.9.0.dev e98a568-py2.7-macosx-10.6-x86_64
When passing a string column with timestamps like
"2012-04-23 10:00:23.123000-07:00"
(fixed offset timezone) to DataFrame.set_index() , getting exception:AttributeError: 'FixedOffsetTimezone' object has no attribute 'zone'
As an aside, I believe this is a common tz-aware timestamp for Postgres, so encountering this with:
df = pd.io.sql.frame_query(QRY, con=_engine.raw_connection(), index_col='ts')
The text was updated successfully, but these errors were encountered: