Created
November 16, 2012 18:18
-
-
Save phobson/4089597 to your computer and use it in GitHub Desktop.
UTC pandas errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: import pandas | |
In [2]: import datetime | |
In [3]: import matplotlib.dates as mdates | |
In [4]: start = mdates.num2date(mdates.datestr2num('2012-1-1')) | |
In [5]: end = mdates.num2date(mdates.datestr2num('2012-6-1')) | |
In [6]: pandas.DatetimeIndex(start=start, end=end, freq='MS') | |
--------------------------------------------------------------------------- | |
AttributeError Traceback (most recent call last) | |
<ipython-input-6-8af3211e7c82> in <module>() | |
----> 1 pandas.DatetimeIndex(start=start, end=end, freq='MS') | |
c:\python27\lib\site-packages\pandas\tseries\index.pyc in __new__(cls, data, freq, start, end, periods, copy, name, tz, verify_integrity, normalize, **kwds) | |
180 if data is None: | |
181 return cls._generate(start, end, periods, name, offset, | |
--> 182 tz=tz, normalize=normalize) | |
183 | |
184 if not isinstance(data, np.ndarray): | |
c:\python27\lib\site-packages\pandas\tseries\index.pyc in _generate(cls, start, end, periods, name, offset, tz, normalize) | |
364 offset=offset, name=name) | |
365 else: | |
--> 366 index = _generate_regular_range(start, end, periods, offset) | |
367 | |
368 if tz is not None and getattr(index, 'tz', None) is None: | |
c:\python27\lib\site-packages\pandas\tseries\index.pyc in _generate_regular_range(start, end, periods, offset) | |
1437 else: | |
1438 if isinstance(start, Timestamp): | |
-> 1439 start = start.to_pydatetime() | |
1440 | |
1441 if isinstance(end, Timestamp): | |
c:\python27\lib\site-packages\pandas\lib.pyd in pandas.lib.Timestamp.to_pydatetime (pandas\src\tseries.c:29680)() | |
c:\python27\lib\site-packages\pandas\lib.pyd in pandas.lib.convert_to_tsobject (pandas\src\tseries.c:33831)() | |
AttributeError: '_UTC' object has no attribute 'normalize' | |
In [7]: pandas.version.version | |
Out[7]: '0.9.1' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment