Skip to content

Commit 69f9441

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 aa03e7f commit 69f9441

20 files changed

+13
-62
lines changed

doc/source/whatsnew/v0.20.0.txt

+11-2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@ Other enhancements
122122
Backwards incompatible API changes
123123
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124124

125+
.. _whatsnew.api_breaking.io_compat
126+
127+
Pickle and HDF5 compat requires >= 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``.
132+
133+
This *may* cause pickles / HDF5 files that were created with the ``pd.TimeSeries`` to become unreadable. (:issue:``15098).
134+
125135
.. _whatsnew.api_breaking.index_map
126136

127137
Map on Index types now return other Index types
@@ -270,8 +280,7 @@ Removal of prior version deprecations/changes
270280
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
271281

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

276285

277286
.. _whatsnew_0200.performance:

pandas/api/tests/test_api.py

+1-1
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

+1-1
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

-16
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

-4
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.

pandas/io/tests/test_pytables.py

-9
Original file line numberDiff line numberDiff line change
@@ -4458,15 +4458,6 @@ def test_pytables_native2_read(self):
44584458
d1 = store['detector']
44594459
self.assertIsInstance(d1, DataFrame)
44604460

4461-
def test_legacy_read(self):
4462-
with ensure_clean_store(
4463-
tm.get_data_path('legacy_hdf/legacy.h5'),
4464-
mode='r') as store:
4465-
store['a']
4466-
store['b']
4467-
store['c']
4468-
store['d']
4469-
44704461
def test_legacy_table_read(self):
44714462
# legacy table types
44724463
with ensure_clean_store(
-862 Bytes
Binary file not shown.
-814 Bytes
Binary file not shown.

pandas/tests/indexes/test_base.py

-9
Original file line numberDiff line numberDiff line change
@@ -381,15 +381,6 @@ def test_view_with_args(self):
381381
# with arguments
382382
ind.view('i8')
383383

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-
393384
def test_astype(self):
394385
casted = self.intIndex.astype('i8')
395386

pandas/tests/series/test_alter_axes.py

-3
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ def test_set_index_makes_timeseries(self):
109109

110110
s = Series(lrange(10))
111111
s.index = idx
112-
113-
with tm.assert_produces_warning(FutureWarning):
114-
self.assertTrue(s.is_time_series)
115112
self.assertTrue(s.index.is_all_dates)
116113

117114
def test_reset_index(self):

pandas/tests/series/test_constructors.py

-15
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,11 @@ def test_scalar_conversion(self):
3838
self.assertEqual(int(Series([1.])), 1)
3939
self.assertEqual(long(Series([1.])), 1)
4040

41-
def test_TimeSeries_deprecation(self):
42-
43-
# deprecation TimeSeries, #10890
44-
with tm.assert_produces_warning(FutureWarning):
45-
pd.TimeSeries(1, index=date_range('20130101', periods=3))
46-
4741
def test_constructor(self):
48-
# Recognize TimeSeries
49-
with tm.assert_produces_warning(FutureWarning):
50-
self.assertTrue(self.ts.is_time_series)
5142
self.assertTrue(self.ts.index.is_all_dates)
5243

5344
# Pass in Series
5445
derived = Series(self.ts)
55-
with tm.assert_produces_warning(FutureWarning):
56-
self.assertTrue(derived.is_time_series)
5746
self.assertTrue(derived.index.is_all_dates)
5847

5948
self.assertTrue(tm.equalContents(derived.index, self.ts.index))
@@ -65,11 +54,7 @@ def test_constructor(self):
6554
self.assertEqual(mixed.dtype, np.object_)
6655
self.assertIs(mixed[1], np.NaN)
6756

68-
with tm.assert_produces_warning(FutureWarning):
69-
self.assertFalse(self.empty.is_time_series)
7057
self.assertFalse(self.empty.index.is_all_dates)
71-
with tm.assert_produces_warning(FutureWarning):
72-
self.assertFalse(Series({}).is_time_series)
7358
self.assertFalse(Series({}).index.is_all_dates)
7459
self.assertRaises(Exception, Series, np.random.randn(3, 3),
7560
index=np.arange(3))

pandas/tests/series/test_timeseries.py

-2
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,6 @@ def test_mpl_compat_hack(self):
547547
def test_timeseries_coercion(self):
548548
idx = tm.makeDateIndex(10000)
549549
ser = Series(np.random.randn(len(idx)), idx.astype(object))
550-
with tm.assert_produces_warning(FutureWarning):
551-
self.assertTrue(ser.is_time_series)
552550
self.assertTrue(ser.index.is_all_dates)
553551
self.assertIsInstance(ser.index, DatetimeIndex)
554552

0 commit comments

Comments
 (0)