From 46274989edf005fce74ba4a8cd3840bc1c408874 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Thu, 5 Dec 2019 11:42:28 -0800 Subject: [PATCH 1/2] DEPR: remove compound --- doc/source/whatsnew/v1.0.0.rst | 1 + pandas/core/generic.py | 23 ----------------------- pandas/tests/series/test_analytics.py | 9 --------- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index 4ce4c12483b36..508886655301c 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -518,6 +518,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more. - Removed the previously deprecated :meth:`Index.summary` (:issue:`18217`) - Removed the previously deprecated "fastpath" keyword from the :class:`Index` constructor (:issue:`23110`) - Removed the previously deprecated :meth:`Series.get_value`, :meth:`Series.set_value`, :meth:`DataFrame.get_value`, :meth:`DataFrame.set_value` (:issue:`17739`) +- Removed the previously deprecated :meth:`Series.compound` and :meth:`DataFrame.compound` (:issue:`26405`) - Changed the the default value of `inplace` in :meth:`DataFrame.set_index` and :meth:`Series.set_axis`. It now defaults to ``False`` (:issue:`27600`) - Removed the previously deprecated :attr:`Series.cat.categorical`, :attr:`Series.cat.index`, :attr:`Series.cat.name` (:issue:`24751`) - Removed the previously deprecated ``time_rule`` keyword from (non-public) :func:`offsets.generate_range`, which has been moved to :func:`core.arrays._ranges.generate_range` (:issue:`24157`) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 9aecd97194aad..7aaa7b6480327 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -10116,29 +10116,6 @@ def mad(self, axis=None, skipna=None, level=None): nanops.nanstd, ) - @Substitution( - desc="Return the compound percentage of the values for " - "the requested axis.\n\n.. deprecated:: 0.25.0", - name1=name, - name2=name2, - axis_descr=axis_descr, - min_count="", - see_also="", - examples="", - ) - @Appender(_num_doc) - def compound(self, axis=None, skipna=None, level=None): - msg = ( - "The 'compound' method is deprecated and will be" - "removed in a future version." - ) - warnings.warn(msg, FutureWarning, stacklevel=2) - if skipna is None: - skipna = True - return (1 + self).prod(axis=axis, skipna=skipna, level=level) - 1 - - cls.compound = compound - cls.cummin = _make_cum_function( cls, "cummin", diff --git a/pandas/tests/series/test_analytics.py b/pandas/tests/series/test_analytics.py index fe9306a06efc7..4270b2db30138 100644 --- a/pandas/tests/series/test_analytics.py +++ b/pandas/tests/series/test_analytics.py @@ -1276,15 +1276,6 @@ def test_validate_stat_keepdims(self): with pytest.raises(ValueError, match=msg): np.sum(s, keepdims=True) - def test_compound_deprecated(self): - s = Series([0.1, 0.2, 0.3, 0.4]) - with tm.assert_produces_warning(FutureWarning): - s.compound() - - df = pd.DataFrame({"s": s}) - with tm.assert_produces_warning(FutureWarning): - df.compound() - main_dtypes = [ "datetime", From 5802e4db0939e47298f9fd2202bcaee58c536bf9 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Thu, 5 Dec 2019 12:08:45 -0800 Subject: [PATCH 2/2] update docs --- doc/redirects.csv | 2 -- doc/source/getting_started/10min.rst | 4 ++-- doc/source/reference/frame.rst | 1 - doc/source/reference/series.rst | 1 - 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/doc/redirects.csv b/doc/redirects.csv index 33ba94e2baa01..1471bfb82c07c 100644 --- a/doc/redirects.csv +++ b/doc/redirects.csv @@ -319,7 +319,6 @@ generated/pandas.DataFrame.clip_upper,../reference/api/pandas.DataFrame.clip_upp generated/pandas.DataFrame.columns,../reference/api/pandas.DataFrame.columns generated/pandas.DataFrame.combine_first,../reference/api/pandas.DataFrame.combine_first generated/pandas.DataFrame.combine,../reference/api/pandas.DataFrame.combine -generated/pandas.DataFrame.compound,../reference/api/pandas.DataFrame.compound generated/pandas.DataFrame.convert_objects,../reference/api/pandas.DataFrame.convert_objects generated/pandas.DataFrame.copy,../reference/api/pandas.DataFrame.copy generated/pandas.DataFrame.corr,../reference/api/pandas.DataFrame.corr @@ -950,7 +949,6 @@ generated/pandas.Series.clip_lower,../reference/api/pandas.Series.clip_lower generated/pandas.Series.clip_upper,../reference/api/pandas.Series.clip_upper generated/pandas.Series.combine_first,../reference/api/pandas.Series.combine_first generated/pandas.Series.combine,../reference/api/pandas.Series.combine -generated/pandas.Series.compound,../reference/api/pandas.Series.compound generated/pandas.Series.compress,../reference/api/pandas.Series.compress generated/pandas.Series.convert_objects,../reference/api/pandas.Series.convert_objects generated/pandas.Series.copy,../reference/api/pandas.Series.copy diff --git a/doc/source/getting_started/10min.rst b/doc/source/getting_started/10min.rst index 41520795bde62..66e500131b316 100644 --- a/doc/source/getting_started/10min.rst +++ b/doc/source/getting_started/10min.rst @@ -75,8 +75,8 @@ will be completed: df2.all df2.columns df2.any df2.combine df2.append df2.combine_first - df2.apply df2.compound - df2.applymap df2.consolidate + df2.apply df2.consolidate + df2.applymap df2.D As you can see, the columns ``A``, ``B``, ``C``, and ``D`` are automatically diff --git a/doc/source/reference/frame.rst b/doc/source/reference/frame.rst index 4c296d74b5ef9..8eeca1ec28054 100644 --- a/doc/source/reference/frame.rst +++ b/doc/source/reference/frame.rst @@ -137,7 +137,6 @@ Computations / descriptive stats DataFrame.all DataFrame.any DataFrame.clip - DataFrame.compound DataFrame.corr DataFrame.corrwith DataFrame.count diff --git a/doc/source/reference/series.rst b/doc/source/reference/series.rst index 1e17b72db2aaf..807dc151dac4e 100644 --- a/doc/source/reference/series.rst +++ b/doc/source/reference/series.rst @@ -174,7 +174,6 @@ Computations / descriptive stats Series.is_monotonic_increasing Series.is_monotonic_decreasing Series.value_counts - Series.compound Reindexing / selection / label manipulation -------------------------------------------