Skip to content

Commit

Permalink
MAINT: Remove combineAdd and combineMult
Browse files Browse the repository at this point in the history
Deprecated in 0.17.0.

xref gh-10735
  • Loading branch information
gfyoung committed Mar 26, 2017
1 parent d2f32a0 commit 5c40359
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 146 deletions.
43 changes: 21 additions & 22 deletions doc/source/10min.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,28 @@ will be completed:

@verbatim
In [1]: df2.<TAB>
df2.A df2.boxplot
df2.abs df2.C
df2.add df2.clip
df2.add_prefix df2.clip_lower
df2.add_suffix df2.clip_upper
df2.align df2.columns
df2.all df2.combine
df2.any df2.combineAdd
df2.A df2.bool
df2.abs df2.boxplot
df2.add df2.C
df2.add_prefix df2.clip
df2.add_suffix df2.clip_lower
df2.align df2.clip_upper
df2.all df2.columns
df2.any df2.combine
df2.append df2.combine_first
df2.apply df2.combineMult
df2.applymap df2.compound
df2.as_blocks df2.consolidate
df2.asfreq df2.convert_objects
df2.as_matrix df2.copy
df2.astype df2.corr
df2.at df2.corrwith
df2.at_time df2.count
df2.axes df2.cov
df2.B df2.cummax
df2.between_time df2.cummin
df2.bfill df2.cumprod
df2.blocks df2.cumsum
df2.bool df2.D
df2.apply df2.compound
df2.applymap df2.consolidate
df2.as_blocks df2.convert_objects
df2.asfreq df2.copy
df2.as_matrix df2.corr
df2.astype df2.corrwith
df2.at df2.count
df2.at_time df2.cov
df2.axes df2.cummax
df2.B df2.cummin
df2.between_time df2.cumprod
df2.bfill df2.cumsum
df2.blocks df2.D

As you can see, the columns ``A``, ``B``, ``C``, and ``D`` are automatically
tab completed. ``E`` is there as well; the rest of the attributes have been
Expand Down
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,8 @@ Removal of prior version deprecations/changes
- The ``take_last`` parameter has been dropped from ``duplicated()``, ``drop_duplicates()``, ``nlargest()``, and ``nsmallest()`` methods (:issue:`10236`, :issue:`10792`, :issue:`10920`)
- ``Series``, ``Index``, and ``DataFrame`` have dropped the ``sort`` and ``order`` methods (:issue:`10726`)
- Where clauses in ``pytables`` are only accepted as strings and expressions types and not other data-types (:issue:`12027`)
- ``DataFrame`` has dropped the ``combineAdd`` and ``combineMult`` methods in favor of ``add`` and ``mul`` respectively (:issue:`10735`)
- ``Series``, ``Index``, and ``DataFrame`` have dropped the ``convert_objects`` method (:issue:`11173`)

.. _whatsnew_0200.performance:

Expand Down
56 changes: 0 additions & 56 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -5362,62 +5362,6 @@ def isin(self, values):
values).reshape(self.shape), self.index,
self.columns)

# ----------------------------------------------------------------------
# Deprecated stuff

def combineAdd(self, other):
"""
DEPRECATED. Use ``DataFrame.add(other, fill_value=0.)`` instead.
Add two DataFrame objects and do not propagate
NaN values, so if for a (column, time) one frame is missing a
value, it will default to the other frame's value (which might
be NaN as well)
Parameters
----------
other : DataFrame
Returns
-------
DataFrame
See also
--------
DataFrame.add
"""
warnings.warn("'combineAdd' is deprecated. Use "
"'DataFrame.add(other, fill_value=0.)' instead",
FutureWarning, stacklevel=2)
return self.add(other, fill_value=0.)

def combineMult(self, other):
"""
DEPRECATED. Use ``DataFrame.mul(other, fill_value=1.)`` instead.
Multiply two DataFrame objects and do not propagate NaN values, so if
for a (column, time) one frame is missing a value, it will default to
the other frame's value (which might be NaN as well)
Parameters
----------
other : DataFrame
Returns
-------
DataFrame
See also
--------
DataFrame.mul
"""
warnings.warn("'combineMult' is deprecated. Use "
"'DataFrame.mul(other, fill_value=1.)' instead",
FutureWarning, stacklevel=2)
return self.mul(other, fill_value=1.)


DataFrame._setup_axes(['index', 'columns'], info_axis=1, stat_axis=0,
axes_are_reversed=True, aliases={'rows': 0})
Expand Down
68 changes: 0 additions & 68 deletions pandas/tests/frame/test_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,74 +1038,6 @@ def test_boolean_comparison(self):
self.assertRaises(ValueError, lambda: df == (2, 2))
self.assertRaises(ValueError, lambda: df == [2, 2])

def test_combineAdd(self):

with tm.assert_produces_warning(FutureWarning):
# trivial
comb = self.frame.combineAdd(self.frame)
assert_frame_equal(comb, self.frame * 2)

# more rigorous
a = DataFrame([[1., nan, nan, 2., nan]],
columns=np.arange(5))
b = DataFrame([[2., 3., nan, 2., 6., nan]],
columns=np.arange(6))
expected = DataFrame([[3., 3., nan, 4., 6., nan]],
columns=np.arange(6))

with tm.assert_produces_warning(FutureWarning):
result = a.combineAdd(b)
assert_frame_equal(result, expected)

with tm.assert_produces_warning(FutureWarning):
result2 = a.T.combineAdd(b.T)
assert_frame_equal(result2, expected.T)

expected2 = a.combine(b, operator.add, fill_value=0.)
assert_frame_equal(expected, expected2)

# corner cases
with tm.assert_produces_warning(FutureWarning):
comb = self.frame.combineAdd(self.empty)
assert_frame_equal(comb, self.frame)

with tm.assert_produces_warning(FutureWarning):
comb = self.empty.combineAdd(self.frame)
assert_frame_equal(comb, self.frame)

# integer corner case
df1 = DataFrame({'x': [5]})
df2 = DataFrame({'x': [1]})
df3 = DataFrame({'x': [6]})

with tm.assert_produces_warning(FutureWarning):
comb = df1.combineAdd(df2)
assert_frame_equal(comb, df3)

# mixed type GH2191
df1 = DataFrame({'A': [1, 2], 'B': [3, 4]})
df2 = DataFrame({'A': [1, 2], 'C': [5, 6]})
with tm.assert_produces_warning(FutureWarning):
rs = df1.combineAdd(df2)
xp = DataFrame({'A': [2, 4], 'B': [3, 4.], 'C': [5, 6.]})
assert_frame_equal(xp, rs)

# TODO: test integer fill corner?

def test_combineMult(self):
with tm.assert_produces_warning(FutureWarning):
# trivial
comb = self.frame.combineMult(self.frame)

assert_frame_equal(comb, self.frame ** 2)

# corner cases
comb = self.frame.combineMult(self.empty)
assert_frame_equal(comb, self.frame)

comb = self.empty.combineMult(self.frame)
assert_frame_equal(comb, self.frame)

def test_combine_generic(self):
df1 = self.frame
df2 = self.frame.loc[self.frame.index[:-5], ['A', 'B', 'C']]
Expand Down

0 comments on commit 5c40359

Please sign in to comment.