Skip to content

Commit 411b170

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 b94186d commit 411b170

20 files changed

+43
-64
lines changed

doc/source/whatsnew/v0.20.0.txt

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

248248

249+
.. _whatsnew.api_breaking.io_compat
250+
251+
Possible incompat for pickle and HDF5 formats for pandas < 0.13.0
252+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
253+
254+
``pd.TimeSeries`` was deprecated officially in 0.17.0, though has only been an alias since 0.13.0. It has
255+
been dropped in favor of ``pd.Series``. (:issue:``15098).
256+
257+
This *may* cause pickles / HDF5 files that were created in prior versions to become unreadable if ``pd.TimeSeries``
258+
was used. This is most likely to be for pandas < 0.13.0. If you find yourself in this situation.
259+
You can use a recent prior version of pandas to read in your pickle / HDF5 files,
260+
then write them out again after applying the procedure below.
261+
262+
.. code-block:: ipython
263+
264+
In [2]: s = pd.TimeSeries([1,2,3], index=pd.date_range('20130101', periods=3))
265+
266+
In [3]: s
267+
Out[3]:
268+
2013-01-01 1
269+
2013-01-02 2
270+
2013-01-03 3
271+
Freq: D, dtype: int64
272+
273+
In [4]: type(s)
274+
Out[4]: pandas.core.series.TimeSeries
275+
276+
In [5]: s = pd.Series(s)
277+
278+
In [6]: s
279+
Out[6]:
280+
2013-01-01 1
281+
2013-01-02 2
282+
2013-01-03 3
283+
Freq: D, dtype: int64
284+
285+
In [7]: type(s)
286+
Out[7]: pandas.core.series.Series
287+
288+
249289
.. _whatsnew_0200.api_breaking.index_map:
250290

251291
Map on Index types now return other Index types
@@ -497,7 +537,7 @@ Removal of prior version deprecations/changes
497537
Similar functionality can be found in the `Google2Pandas <https://github.com/panalysis/Google2Pandas>`__ package.
498538
- ``pd.to_datetime`` and ``pd.to_timedelta`` have dropped the ``coerce`` parameter in favor of ``errors`` (:issue:`13602`)
499539
- ``pandas.stats.fama_macbeth``, ``pandas.stats.ols``, ``pandas.stats.plm`` and ``pandas.stats.var``, as well as the top-level ``pandas.fama_macbeth`` and ``pandas.ols`` routines are removed. Similar functionaility can be found in the `statsmodels <shttp://www.statsmodels.org/dev/>`__ package. (:issue:`11898`)
500-
540+
- ``Series.is_time_series`` is dropped in favor of ``Series.index.is_all_dates`` (:issue:``)
501541

502542

503543
.. _whatsnew_0200.performance:

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, concat,
3028
SparseSeries, SparseDataFrame, PeriodIndex,
@@ -166,7 +164,6 @@ class DuplicateWarning(Warning):
166164

167165
Series: u('series'),
168166
SparseSeries: u('sparse_series'),
169-
pd.TimeSeries: u('series'),
170167
DataFrame: u('frame'),
171168
SparseDataFrame: u('sparse_frame'),
172169
Panel: u('wide'),
@@ -175,7 +172,6 @@ class DuplicateWarning(Warning):
175172

176173
# storer class map
177174
_STORER_MAP = {
178-
u('TimeSeries'): 'LegacySeriesFixed',
179175
u('Series'): 'LegacySeriesFixed',
180176
u('DataFrame'): 'LegacyFrameFixed',
181177
u('DataMatrix'): 'LegacyFrameFixed',

pandas/tests/api/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

-862 Bytes
Binary file not shown.
-814 Bytes
Binary file not shown.

pandas/tests/indexes/test_base.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
from pandas.compat import (range, lrange, lzip, u,
1010
text_type, zip, PY3, PY36)
1111
import operator
12-
import os
13-
1412
import numpy as np
1513

1614
from pandas import (period_range, date_range, Series,
@@ -381,15 +379,6 @@ def test_view_with_args(self):
381379
# with arguments
382380
ind.view('i8')
383381

384-
def test_legacy_pickle_identity(self):
385-
386-
# GH 8431
387-
pth = tm.get_data_path()
388-
s1 = pd.read_pickle(os.path.join(pth, 's1-0.12.0.pickle'))
389-
s2 = pd.read_pickle(os.path.join(pth, 's2-0.12.0.pickle'))
390-
self.assertFalse(s1.index.identical(s2.index))
391-
self.assertFalse(s1.index.equals(s2.index))
392-
393382
def test_astype(self):
394383
casted = self.intIndex.astype('i8')
395384

-14.6 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)