Skip to content

Commit

Permalink
ENH: set __module__ on merge functions in merge.py (#60266)
Browse files Browse the repository at this point in the history
  • Loading branch information
chanshing authored Nov 11, 2024
1 parent d770a80 commit e531732
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
npt,
)
from pandas.errors import MergeError
from pandas.util._decorators import cache_readonly
from pandas.util._decorators import (
cache_readonly,
set_module,
)
from pandas.util._exceptions import find_stack_level

from pandas.core.dtypes.base import ExtensionDtype
Expand Down Expand Up @@ -138,6 +141,7 @@
_known = (np.ndarray, ExtensionArray, Index, ABCSeries)


@set_module("pandas")
def merge(
left: DataFrame | Series,
right: DataFrame | Series,
Expand Down Expand Up @@ -502,6 +506,7 @@ def _groupby_and_merge(
return result, lby


@set_module("pandas")
def merge_ordered(
left: DataFrame | Series,
right: DataFrame | Series,
Expand Down Expand Up @@ -645,6 +650,7 @@ def _merger(x, y) -> DataFrame:
return result


@set_module("pandas")
def merge_asof(
left: DataFrame | Series,
right: DataFrame | Series,
Expand Down
3 changes: 3 additions & 0 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ def test_set_module():
assert pd.Period.__module__ == "pandas"
assert pd.Timestamp.__module__ == "pandas"
assert pd.Timedelta.__module__ == "pandas"
assert pd.merge.__module__ == "pandas"
assert pd.merge_ordered.__module__ == "pandas"
assert pd.merge_asof.__module__ == "pandas"
assert pd.read_csv.__module__ == "pandas"
assert pd.read_table.__module__ == "pandas"
assert pd.read_fwf.__module__ == "pandas"
Expand Down

0 comments on commit e531732

Please sign in to comment.