Skip to content

Commit 680f964

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 542c916 commit 680f964

20 files changed

+43
-65
lines changed

doc/source/whatsnew/v0.20.0.txt

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,46 @@ Using ``.iloc``. Here we will get the location of the 'A' column, then use *posi
204204
df.iloc[[0, 2], df.columns.get_loc('A')]
205205

206206

207+
.. _whatsnew.api_breaking.io_compat
208+
209+
Possible incompat for pickle and HDF5 formats for pandas < 0.13.0
210+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
211+
212+
``pd.TimeSeries`` was deprecated officially in 0.17.0, though has only been an alias since 0.13.0. It has
213+
been dropped in favor of ``pd.Series``. (:issue:``15098).
214+
215+
This *may* cause pickles / HDF5 files that were created in prior versions to become unreadable if ``pd.TimeSeries``
216+
was used. This is most likely to be for pandas < 0.13.0. If you find yourself in this situation.
217+
You can use a recent prior version of pandas to read in your pickle / HDF5 files,
218+
then write them out again after applying the procedure below.
219+
220+
.. code-block:: ipython
221+
222+
In [2]: s = pd.TimeSeries([1,2,3], index=pd.date_range('20130101', periods=3))
223+
224+
In [3]: s
225+
Out[3]:
226+
2013-01-01 1
227+
2013-01-02 2
228+
2013-01-03 3
229+
Freq: D, dtype: int64
230+
231+
In [4]: type(s)
232+
Out[4]: pandas.core.series.TimeSeries
233+
234+
In [5]: s = pd.Series(s)
235+
236+
In [6]: s
237+
Out[6]:
238+
2013-01-01 1
239+
2013-01-02 2
240+
2013-01-03 3
241+
Freq: D, dtype: int64
242+
243+
In [7]: type(s)
244+
Out[7]: pandas.core.series.Series
245+
246+
207247
.. _whatsnew_0200.api_breaking.index_map:
208248

209249
Map on Index types now return other Index types
@@ -395,8 +435,7 @@ Removal of prior version deprecations/changes
395435
- The ``pandas.io.ga`` module with a ``google-analytics`` interface is removed (:issue:`11308`).
396436
Similar functionality can be found in the `Google2Pandas <https://github.com/panalysis/Google2Pandas>`__ package.
397437
- ``pd.to_datetime`` and ``pd.to_timedelta`` have dropped the ``coerce`` parameter in favor of ``errors`` (:issue:`13602`)
398-
399-
438+
- ``Series.is_time_series`` is dropped in favor of ``Series.index.is_all_dates`` (:issue:``)
400439

401440

402441
.. _whatsnew_0200.performance:

pandas/api/tests/test_api.py

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

5959
# these are already deprecated; awaiting removal
60-
deprecated_classes = ['TimeSeries', 'WidePanel',
60+
deprecated_classes = ['WidePanel',
6161
'SparseTimeSeries', 'Panel4D',
6262
'SparseList']
6363

pandas/core/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
UInt64Index, RangeIndex, Float64Index,
1414
MultiIndex)
1515

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

pandas/core/series.py

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

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

289282
def _set_axis(self, axis, labels, fastpath=False):
@@ -2985,16 +2978,6 @@ def create_from_value(value, index, dtype):
29852978
return subarr
29862979

29872980

2988-
# backwards compatiblity
2989-
class TimeSeries(Series):
2990-
2991-
def __init__(self, *args, **kwargs):
2992-
# deprecation TimeSeries, #10890
2993-
warnings.warn("TimeSeries is deprecated. Please use Series",
2994-
FutureWarning, stacklevel=2)
2995-
2996-
super(TimeSeries, self).__init__(*args, **kwargs)
2997-
29982981
# ----------------------------------------------------------------------
29992982
# Add plotting methods to Series
30002983

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)