Skip to content

Commit

Permalink
DEPR: deprecate SparsePanel
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Sep 20, 2015
1 parent 9e7dc17 commit b32477b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.17.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,7 @@ Deprecations
``DataFrame.add(other, fill_value=0)`` and ``DataFrame.mul(other, fill_value=1.)``
(:issue:`10735`).
- ``TimeSeries`` deprecated in favor of ``Series`` (note that this has been alias since 0.13.0), (:issue:`10890`)
- ``SparsePanel`` deprecated and will be removed in a future version (:issue:``)
- ``Series.is_time_series`` deprecated in favor of ``Series.index.is_all_dates`` (:issue:`11135`)
- 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`)
- ``WidePanel`` deprecated in favor of ``Panel``, ``LongPanel`` in favor of ``DataFrame`` (note these have been aliases since < 0.11.0), (:issue:`10892`)
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2566,7 +2566,7 @@ def last_valid_index(self):

def asof(self, where):
"""
Return last good (non-NaN) value in TimeSeries if value is NaN for
Return last good (non-NaN) value in Series if value is NaN for
requested date.
If there is no good value, NaN is returned.
Expand Down Expand Up @@ -2624,7 +2624,7 @@ def to_timestamp(self, freq=None, how='start', copy=True):
Returns
-------
ts : TimeSeries with DatetimeIndex
ts : Series with DatetimeIndex
"""
new_values = self._values
if copy:
Expand All @@ -2636,7 +2636,7 @@ def to_timestamp(self, freq=None, how='start', copy=True):

def to_period(self, freq=None, copy=True):
"""
Convert TimeSeries from DatetimeIndex to PeriodIndex with desired
Convert Series from DatetimeIndex to PeriodIndex with desired
frequency (inferred from index if not passed)
Parameters
Expand All @@ -2645,7 +2645,7 @@ def to_period(self, freq=None, copy=True):
Returns
-------
ts : TimeSeries with PeriodIndex
ts : Series with PeriodIndex
"""
new_values = self._values
if copy:
Expand Down
5 changes: 5 additions & 0 deletions pandas/sparse/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# pylint: disable=E1101,E1103,W0231

import warnings
from pandas.compat import range, lrange, zip
from pandas import compat
import numpy as np
Expand Down Expand Up @@ -69,6 +70,10 @@ def __init__(self, frames=None, items=None, major_axis=None, minor_axis=None,
default_fill_value=np.nan, default_kind='block',
copy=False):

# deprecation #11157
warnings.warn("SparsePanel is deprecated and will be removed in a future version",
FutureWarning, stacklevel=2)

if frames is None:
frames = {}

Expand Down
5 changes: 5 additions & 0 deletions pandas/sparse/tests/test_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,11 @@ def test_constructor(self):
"input must be a dict, a 'list' was passed"):
SparsePanel(['a', 'b', 'c'])

# deprecation GH11157
def test_deprecation(self):
with tm.assert_produces_warning(FutureWarning):
SparsePanel()

# GH 9272
def test_constructor_empty(self):
sp = SparsePanel()
Expand Down

0 comments on commit b32477b

Please sign in to comment.