Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10177,11 +10177,14 @@ def mad(self, axis=None, skipna=None, level=None):
nanops.nanstd)

@Substitution(desc="Return the compound percentage of the values for "
"the requested axis.", name1=name, name2=name2,
axis_descr=axis_descr,
"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
Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/series/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,15 @@ def test_validate_stat_keepdims(self):
with pytest.raises(ValueError, match=msg):
np.sum(s, keepdims=True)

def test_compound_deprecated(self):
s = Series([.1, .2, .3, .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',
Expand Down