Skip to content

Commit b32477b

Browse files
committed
DEPR: deprecate SparsePanel
1 parent 9e7dc17 commit b32477b

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

doc/source/whatsnew/v0.17.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ Deprecations
964964
``DataFrame.add(other, fill_value=0)`` and ``DataFrame.mul(other, fill_value=1.)``
965965
(:issue:`10735`).
966966
- ``TimeSeries`` deprecated in favor of ``Series`` (note that this has been alias since 0.13.0), (:issue:`10890`)
967+
- ``SparsePanel`` deprecated and will be removed in a future version (:issue:``)
967968
- ``Series.is_time_series`` deprecated in favor of ``Series.index.is_all_dates`` (:issue:`11135`)
968969
- Legacy offsets (like ``'A@JAN'``) listed in :ref:`here <timeseries.legacyaliases>` are deprecated (note that this has been alias since 0.8.0), (:issue:`10878`)
969970
- ``WidePanel`` deprecated in favor of ``Panel``, ``LongPanel`` in favor of ``DataFrame`` (note these have been aliases since < 0.11.0), (:issue:`10892`)

pandas/core/series.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2566,7 +2566,7 @@ def last_valid_index(self):
25662566

25672567
def asof(self, where):
25682568
"""
2569-
Return last good (non-NaN) value in TimeSeries if value is NaN for
2569+
Return last good (non-NaN) value in Series if value is NaN for
25702570
requested date.
25712571
25722572
If there is no good value, NaN is returned.
@@ -2624,7 +2624,7 @@ def to_timestamp(self, freq=None, how='start', copy=True):
26242624
26252625
Returns
26262626
-------
2627-
ts : TimeSeries with DatetimeIndex
2627+
ts : Series with DatetimeIndex
26282628
"""
26292629
new_values = self._values
26302630
if copy:
@@ -2636,7 +2636,7 @@ def to_timestamp(self, freq=None, how='start', copy=True):
26362636

26372637
def to_period(self, freq=None, copy=True):
26382638
"""
2639-
Convert TimeSeries from DatetimeIndex to PeriodIndex with desired
2639+
Convert Series from DatetimeIndex to PeriodIndex with desired
26402640
frequency (inferred from index if not passed)
26412641
26422642
Parameters
@@ -2645,7 +2645,7 @@ def to_period(self, freq=None, copy=True):
26452645
26462646
Returns
26472647
-------
2648-
ts : TimeSeries with PeriodIndex
2648+
ts : Series with PeriodIndex
26492649
"""
26502650
new_values = self._values
26512651
if copy:

pandas/sparse/panel.py

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
# pylint: disable=E1101,E1103,W0231
77

8+
import warnings
89
from pandas.compat import range, lrange, zip
910
from pandas import compat
1011
import numpy as np
@@ -69,6 +70,10 @@ def __init__(self, frames=None, items=None, major_axis=None, minor_axis=None,
6970
default_fill_value=np.nan, default_kind='block',
7071
copy=False):
7172

73+
# deprecation #11157
74+
warnings.warn("SparsePanel is deprecated and will be removed in a future version",
75+
FutureWarning, stacklevel=2)
76+
7277
if frames is None:
7378
frames = {}
7479

pandas/sparse/tests/test_sparse.py

+5
Original file line numberDiff line numberDiff line change
@@ -1793,6 +1793,11 @@ def test_constructor(self):
17931793
"input must be a dict, a 'list' was passed"):
17941794
SparsePanel(['a', 'b', 'c'])
17951795

1796+
# deprecation GH11157
1797+
def test_deprecation(self):
1798+
with tm.assert_produces_warning(FutureWarning):
1799+
SparsePanel()
1800+
17961801
# GH 9272
17971802
def test_constructor_empty(self):
17981803
sp = SparsePanel()

0 commit comments

Comments
 (0)