diff --git a/doc/source/whatsnew/v0.8.0.txt b/doc/source/whatsnew/v0.8.0.txt index c1dd2f7abd91c..79261e32a9c3b 100644 --- a/doc/source/whatsnew/v0.8.0.txt +++ b/doc/source/whatsnew/v0.8.0.txt @@ -28,7 +28,7 @@ clear of NumPy 1.6's datetime64 API functions (though limited as they are) and only interact with this data using the interface that pandas provides. Bug fixes to the 0.7.x series for legacy NumPy < 1.6 users will be provided as -they arise. There will be no more further development in 1.7.x beyond bug +they arise. There will be no more further development in 0.7.x beyond bug fixes. Time series changes and improvements @@ -39,6 +39,10 @@ Time series changes and improvements With this release, legacy scikits.timeseries users should be able to port their code to use pandas. +.. note:: + + See :ref:`documentation ` for overview of pandas timeseries API. + - New datetime64 representation **speeds up join operations and data alignment**, **reduces memory usage**, and improve serialization / deserialization performance significantly over datetime.datetime @@ -133,7 +137,7 @@ Other new features - Add max_colwidth configuration option for DataFrame console output - Interpolate Series values using index values - Can select multiple columns from GroupBy -- Add Series/DataFrame.update methods for updating values in place +- Add Series/DataFrame.:ref:`update ` methods for updating values in place Other API changes ~~~~~~~~~~~~~~~~~ diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py index e1b033eb88227..c8b7d4da93fb7 100644 --- a/pandas/tseries/index.py +++ b/pandas/tseries/index.py @@ -253,13 +253,13 @@ def __new__(cls, data=None, # Convert local to UTC ints = subarr.view('i8') lib.tz_localize_check(ints, tz) - subarr = lib.tz_convert(ints, tz, _utc()) + subarr = lib.tz_convert(ints, tz, getattr(data, 'tz', _utc())) subarr = subarr.view('M8[ns]') subarr = subarr.view(cls) subarr.name = name subarr.offset = offset - subarr.tz = tz + subarr.tz = getattr(data, 'tz', tz) if verify_integrity and len(subarr) > 0: if offset is not None and not infer_freq: @@ -540,7 +540,9 @@ def asobject(self): def _get_object_index(self): boxed_values = _dt_box_array(self.asi8, self.offset, self.tz) - return Index(boxed_values, dtype=object) + idx = Index(boxed_values, dtype=object) + idx.tz = self.tz + return idx def to_period(self, freq=None): """ diff --git a/pandas/tseries/tests/test_timezones.py b/pandas/tseries/tests/test_timezones.py index 8aaff3ac80801..728ee95605009 100644 --- a/pandas/tseries/tests/test_timezones.py +++ b/pandas/tseries/tests/test_timezones.py @@ -228,6 +228,14 @@ def test_asobject_tz_box(self): result = index.asobject self.assert_(result[0].tz is tz) + def test_asobject_tz(self): + tz = pytz.timezone('US/Eastern') + index = DatetimeIndex(start='1/1/2005', periods=10, tz=tz, + freq='B') + + result = DatetimeIndex(index.asobject) + self.assert_(result.tz is tz) + def test_tz_string(self): result = date_range('1/1/2000', periods=10, tz='US/Eastern') expected = date_range('1/1/2000', periods=10,