Skip to content

Commit 4a6f484

Browse files
committed
DEPR: remove legacy pd.TimeSeries class in favor of pd.Series
xref #10890 DEPR: remove Series.is_time_series in favor of Series.index.is_all_dates
1 parent c71f214 commit 4a6f484

20 files changed

+43
-64
lines changed

doc/source/whatsnew/v0.20.0.txt

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,46 @@ Other enhancements
122122
Backwards incompatible API changes
123123
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124124

125+
.. _whatsnew.api_breaking.io_compat
126+
127+
Possible incompat for pickle and HDF5 formats for pandas < 0.13.0
128+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129+
130+
``pd.TimeSeries`` was deprecated officially in 0.17.0, though has only been an alias since 0.13.0. It has
131+
been dropped in favor of ``pd.Series``. (:issue:``15098).
132+
133+
This *may* cause pickles / HDF5 files that were created in prior versions to become unreadable if ``pd.TimeSeries``
134+
was used. This is most likely to be for pandas < 0.13.0. If you find yourself in this situation.
135+
You can use a recent prior version of pandas to read in your pickle / HDF5 files,
136+
then write them out again after applying the procedure below.
137+
138+
.. code-block:: ipython
139+
140+
In [2]: s = pd.TimeSeries([1,2,3], index=pd.date_range('20130101', periods=3))
141+
142+
In [3]: s
143+
Out[3]:
144+
2013-01-01 1
145+
2013-01-02 2
146+
2013-01-03 3
147+
Freq: D, dtype: int64
148+
149+
In [4]: type(s)
150+
Out[4]: pandas.core.series.TimeSeries
151+
152+
In [5]: s = pd.Series(s)
153+
154+
In [6]: s
155+
Out[6]:
156+
2013-01-01 1
157+
2013-01-02 2
158+
2013-01-03 3
159+
Freq: D, dtype: int64
160+
161+
In [7]: type(s)
162+
Out[7]: pandas.core.series.Series
163+
164+
125165
.. _whatsnew.api_breaking.index_map
126166

127167
Map on Index types now return other Index types
@@ -270,8 +310,7 @@ Removal of prior version deprecations/changes
270310
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
271311

272312
- ``pd.to_datetime`` and ``pd.to_timedelta`` have dropped the ``coerce`` parameter in favor of ``errors`` (:issue:`13602`)
273-
274-
313+
- ``Series.is_time_series`` is dropped in favor of ``Series.index.is_all_dates`` (:issue:``)
275314

276315

277316
.. _whatsnew_0200.performance:

pandas/api/tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class TestPDApi(Base, tm.TestCase):
5959
'TimedeltaIndex', 'Timestamp']
6060

6161
# these are already deprecated; awaiting removal
62-
deprecated_classes = ['TimeSeries', 'WidePanel',
62+
deprecated_classes = ['WidePanel',
6363
'SparseTimeSeries', 'Panel4D',
6464
'SparseList']
6565

pandas/core/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from pandas.core.index import (Index, CategoricalIndex, Int64Index,
1313
RangeIndex, Float64Index, MultiIndex)
1414

15-
from pandas.core.series import Series, TimeSeries
15+
from pandas.core.series import Series
1616
from pandas.core.frame import DataFrame
1717
from pandas.core.panel import Panel, WidePanel
1818
from pandas.core.panel4d import Panel4D

pandas/core/series.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,6 @@ def _constructor_expanddim(self):
276276
def _can_hold_na(self):
277277
return self._data._can_hold_na
278278

279-
@property
280-
def is_time_series(self):
281-
warnings.warn("is_time_series is deprecated. Please use "
282-
"Series.index.is_all_dates", FutureWarning, stacklevel=2)
283-
# return self._subtyp in ['time_series', 'sparse_time_series']
284-
return self.index.is_all_dates
285-
286279
_index = None
287280

288281
def _set_axis(self, axis, labels, fastpath=False):
@@ -2980,15 +2973,6 @@ def create_from_value(value, index, dtype):
29802973
return subarr
29812974

29822975

2983-
# backwards compatiblity
2984-
class TimeSeries(Series):
2985-
def __init__(self, *args, **kwargs):
2986-
# deprecation TimeSeries, #10890
2987-
warnings.warn("TimeSeries is deprecated. Please use Series",
2988-
FutureWarning, stacklevel=2)
2989-
2990-
super(TimeSeries, self).__init__(*args, **kwargs)
2991-
29922976
# ----------------------------------------------------------------------
29932977
# Add plotting methods to Series
29942978

pandas/io/pytables.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
from pandas.types.missing import array_equivalent
2424

2525
import numpy as np
26-
27-
import pandas as pd
2826
from pandas import (Series, DataFrame, Panel, Panel4D, Index,
2927
MultiIndex, Int64Index, isnull)
3028
from pandas.core import config
@@ -164,7 +162,6 @@ class DuplicateWarning(Warning):
164162

165163
Series: u('series'),
166164
SparseSeries: u('sparse_series'),
167-
pd.TimeSeries: u('series'),
168165
DataFrame: u('frame'),
169166
SparseDataFrame: u('sparse_frame'),
170167
Panel: u('wide'),
@@ -173,7 +170,6 @@ class DuplicateWarning(Warning):
173170

174171
# storer class map
175172
_STORER_MAP = {
176-
u('TimeSeries'): 'LegacySeriesFixed',
177173
u('Series'): 'LegacySeriesFixed',
178174
u('DataFrame'): 'LegacyFrameFixed',
179175
u('DataMatrix'): 'LegacyFrameFixed',
-14.6 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)