Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

meet-vasita
Copy link

Set __module__ = "pandas" on NaTType and NAType to fix incorrect autodoc "alias of" messages.
Closes #62185.

meet-vasita and others added 3 commits September 11, 2025 01:06
…s message

Set __module__ = 'pandas' on NaTType and NAType to fix incorrect autodoc 'alias of' messages.
Closes pandas-dev#62185.
Fixes Sphinx autodoc showing circular 'alias of' references
for pandas.NA and pandas.NaT by explicitly setting their
__module__ attribute to 'pandas'.

Closes pandas-dev#62185
@meet-vasita
Copy link
Author

meet-vasita commented Sep 10, 2025

Hi @rhshadrach, I've implemented your suggested fix by adding __module__ = "pandas" to both NAType and NaTType classes.

Would you be able to review this PR when you have a chance? Thanks for identifying the root cause and providing the solution direction.

@simonjayhawkins
Copy link
Member

/docbuild

@simonjayhawkins
Copy link
Member

/preview

Copy link
Contributor

Website preview of this PR available at: https://pandas.pydata.org/preview/pandas-dev/pandas/62313/

@simonjayhawkins
Copy link
Member

@rhshadrach
Copy link
Member

Thanks @meet-vasita and @simonjayhawkins - I think the remaining issue is that NA and NaT are not classes, they are instances of classes. I don't believe instances play well with autodoc. I get the "desired" output by changing https://github.com/pandas-dev/pandas/blob/main/doc/source/reference/missing_value.rst to use

api.tying.NAType

and

api.typing.NaTType

But there is the less-than desired effect of having the class show up in the API page. Open to thoughts here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: NaT - "alias of NaT"; NA - "alias of <NA>"
3 participants