Skip to content

Commit 2f53d18

Browse files
committed
Fix NaT and NA docs: Set __module__ to 'pandas' to prevent wrong alias message
Set __module__ = 'pandas' on NaTType and NAType to fix incorrect autodoc 'alias of' messages. Closes #62185.
1 parent 3e1d6d5 commit 2f53d18

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pandas/_libs/missing.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ class NAType(C_NAType):
377377
"""
378378

379379
_instance = None
380+
__module__ = "pandas"
380381

381382
def __new__(cls, *args, **kwargs):
382383
if NAType._instance is None:

pandas/_libs/tslibs/nattype.pyx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,11 @@ default 'raise'
18281828
@property
18291829
def tzinfo(self) -> None:
18301830
return None
1831-
1831+
1832+
@property
1833+
def __module__(self) -> str:
1834+
return "pandas"
1835+
18321836
def as_unit(self, str unit, bint round_ok=True) -> "NaTType":
18331837
"""
18341838
Convert the underlying int64 representation to the given unit.
@@ -1868,6 +1872,7 @@ default 'raise'
18681872

18691873

18701874
c_NaT = NaTType() # C-visible
1875+
c_NaT.__module__ = "pandas"
18711876
NaT = c_NaT # Python-visible
18721877

18731878

0 commit comments

Comments
 (0)