Skip to content

Commit

Permalink
remove pd.ordered_merge
Browse files Browse the repository at this point in the history
  • Loading branch information
tp committed Nov 23, 2017
1 parent b45325e commit e1b862a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 34 deletions.
6 changes: 1 addition & 5 deletions asv_bench/benchmarks/join_merge.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
from .pandas_vb_common import *

try:
from pandas import merge_ordered
except ImportError:
from pandas import ordered_merge as merge_ordered

from pandas import merge_ordered

# ----------------------------------------------------------------------
# Append
Expand Down
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.22.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Removal of prior version deprecations/changes
- The ``levels`` and ``labels`` attributes of a ``MultiIndex`` can no longer be set directly (:issue:`4039`).
- ``pd.tseries.util.pivot_annual`` has been removed (deprecated since v0.19). Use ``pivot_table`` instead (:issue:`18370`)
- ``pd.tseries.util.isleapyear`` has been removed (deprecated since v0.19). Use ``.is_leap_year`` property in Datetime-likes instead (:issue:`18370`)
- ``pd.ordered_merge`` has been removed (deprecated since v0.19). Use ``pd..merge_ordered`` instead (:issue:`18459`)

.. _whatsnew_0220.performance:

Expand Down
3 changes: 1 addition & 2 deletions pandas/core/reshape/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from pandas.core.reshape.concat import concat
from pandas.core.reshape.melt import melt, lreshape, wide_to_long
from pandas.core.reshape.reshape import pivot_simple as pivot, get_dummies
from pandas.core.reshape.merge import (
merge, ordered_merge, merge_ordered, merge_asof)
from pandas.core.reshape.merge import merge, merge_ordered, merge_asof
from pandas.core.reshape.pivot import pivot_table, crosstab
from pandas.core.reshape.tile import cut, qcut
20 changes: 2 additions & 18 deletions pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,6 @@ def _groupby_and_merge(by, on, left, right, _merge_pieces,
return result, lby


def ordered_merge(left, right, on=None,
left_on=None, right_on=None,
left_by=None, right_by=None,
fill_method=None, suffixes=('_x', '_y')):

warnings.warn("ordered_merge is deprecated and replaced by merge_ordered",
FutureWarning, stacklevel=2)
return merge_ordered(left, right, on=on,
left_on=left_on, right_on=right_on,
left_by=left_by, right_by=right_by,
fill_method=fill_method, suffixes=suffixes)


def merge_ordered(left, right, on=None,
left_on=None, right_on=None,
left_by=None, right_by=None,
Expand Down Expand Up @@ -204,7 +191,7 @@ def merge_ordered(left, right, on=None,
4 c 2 b
5 e 3 b
>>> ordered_merge(A, B, fill_method='ffill', left_by='group')
>>> merge_ordered(A, B, fill_method='ffill', left_by='group')
key lvalue group rvalue
0 a 1 a NaN
1 b 1 a 1
Expand Down Expand Up @@ -253,9 +240,6 @@ def _merger(x, y):
return result


ordered_merge.__doc__ = merge_ordered.__doc__


def merge_asof(left, right, on=None,
left_on=None, right_on=None,
left_index=False, right_index=False,
Expand Down Expand Up @@ -1083,7 +1067,7 @@ def _get_join_indexers(left_keys, right_keys, sort=False, how='inner',


class _OrderedMerge(_MergeOperation):
_merge_type = 'ordered_merge'
_merge_type = 'merge_ordered'

def __init__(self, left, right, on=None, left_on=None, right_on=None,
left_index=False, right_index=False, axis=1,
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class TestPDApi(Base):
'rolling_kurt', 'rolling_max', 'rolling_mean',
'rolling_median', 'rolling_min', 'rolling_quantile',
'rolling_skew', 'rolling_std', 'rolling_sum',
'rolling_var', 'rolling_window', 'ordered_merge',
'rolling_var', 'rolling_window',
'pnow', 'match', 'groupby', 'get_store',
'plot_params', 'scatter_matrix']

Expand Down
9 changes: 1 addition & 8 deletions pandas/tests/reshape/test_merge_ordered.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from numpy import nan


class TestOrderedMerge(object):
class TestMergeOrdered(object):

def setup_method(self, method):
self.left = DataFrame({'key': ['a', 'c', 'e'],
Expand All @@ -15,13 +15,6 @@ def setup_method(self, method):
self.right = DataFrame({'key': ['b', 'c', 'd', 'f'],
'rvalue': [1, 2, 3., 4]})

def test_deprecation(self):

with tm.assert_produces_warning(FutureWarning):
pd.ordered_merge(self.left, self.right, on='key')

# GH #813

def test_basic(self):
result = merge_ordered(self.left, self.right, on='key')
expected = DataFrame({'key': ['a', 'b', 'c', 'd', 'e', 'f'],
Expand Down

0 comments on commit e1b862a

Please sign in to comment.