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
Next Next commit
Used decorators to set __module__ for to_datetime, to_timedelta, to_n…
…umeric
  • Loading branch information
mpak123 committed Sep 17, 2025
commit aa37ef87657aa7ea4966575cfcbfff93766a6a01
2 changes: 2 additions & 0 deletions pandas/core/tools/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
ArrayLike,
DateTimeErrorChoices,
)
from pandas.util._decorators import set_module
from pandas.util._exceptions import find_stack_level

from pandas.core.dtypes.common import (
Expand Down Expand Up @@ -666,6 +667,7 @@ def to_datetime(
) -> DatetimeIndex: ...


@set_module("pandas")
def to_datetime(
arg: DatetimeScalarOrArrayConvertible | DictConvertible,
errors: DateTimeErrorChoices = "raise",
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/tools/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Timedelta,
Timestamp,
)
from pandas.util._decorators import set_module
from pandas.util._validators import check_dtype_backend

from pandas.core.dtypes.cast import maybe_downcast_numeric
Expand Down Expand Up @@ -46,6 +47,7 @@
)


@set_module("pandas")
def to_numeric(
arg,
errors: DateTimeErrorChoices = "raise",
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/tools/timedeltas.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
disallow_ambiguous_unit,
parse_timedelta_unit,
)
from pandas.util._decorators import set_module

from pandas.core.dtypes.common import is_list_like
from pandas.core.dtypes.dtypes import ArrowDtype
Expand Down Expand Up @@ -73,6 +74,7 @@ def to_timedelta(
) -> TimedeltaIndex: ...


@set_module("pandas")
def to_timedelta(
arg: str
| int
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 @@ -453,6 +453,9 @@ def test_set_module():
assert pd.date_range.__module__ == "pandas"
assert pd.bdate_range.__module__ == "pandas"
assert pd.timedelta_range.__module__ == "pandas"
assert pd.to_datetime.__module__ == "pandas"
assert pd.to_timedelta.__module__ == "pandas"
assert pd.to_numeric.__module__ == "pandas"
assert pd.NamedAgg.__module__ == "pandas"
assert api.typing.SeriesGroupBy.__module__ == "pandas.api.typing"
assert api.typing.DataFrameGroupBy.__module__ == "pandas.api.typing"
Loading