diff --git a/doc/_templates/autosummary/class.rst b/doc/_templates/autosummary/class.rst index a9c9bd2b6507f..79c2e37b0192f 100644 --- a/doc/_templates/autosummary/class.rst +++ b/doc/_templates/autosummary/class.rst @@ -1,33 +1,32 @@ -{% extends "!autosummary/class.rst" %} +{{ fullname | escape | underline}} -{% block methods %} -{% if methods %} +.. currentmodule:: {{ module }} -.. - HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages. - .. autosummary:: - :toctree: - {% for item in all_methods %} - {%- if not item.startswith('_') or item in ['__call__'] %} - {{ name }}.{{ item }} - {%- endif -%} - {%- endfor %} +.. autoclass:: {{ objname }} -{% endif %} -{% endblock %} + {% block methods %} -{% block attributes %} -{% if attributes %} + {% block attributes %} + {% if attributes %} + .. rubric:: {{ _('Attributes') }} -.. - HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages. .. autosummary:: - :toctree: - {% for item in all_attributes %} - {%- if not item.startswith('_') %} - {{ name }}.{{ item }} - {%- endif -%} - {%- endfor %} + {% for item in attributes %} + {% if item in members and not item.startswith('_') %} + ~{{ name }}.{{ item }} + {% endif %} + {%- endfor %} + {% endif %} + {% endblock %} + + {% if methods %} + .. rubric:: {{ _('Methods') }} -{% endif %} -{% endblock %} + .. autosummary:: + {% for item in methods %} + {% if item in members and (not item.startswith('_') or item in ['__call__']) %} + ~{{ name }}.{{ item }} + {% endif %} + {%- endfor %} + {% endif %} + {% endblock %} diff --git a/doc/source/conf.py b/doc/source/conf.py index 7309dc82c970b..accbff596b12d 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -76,7 +76,6 @@ # to ensure that include files (partial pages) aren't built, exclude them # https://github.com/sphinx-doc/sphinx/issues/1965#issuecomment-124732907 "**/includes/**", - "**/api/pandas.Series.dt.rst", ] try: import nbconvert @@ -130,6 +129,8 @@ autodoc_typehints = "none" # numpydoc +numpydoc_show_class_members = False +numpydoc_show_inherited_class_members = False numpydoc_attributes_as_param_list = False # matplotlib plot directive diff --git a/doc/source/reference/series.rst b/doc/source/reference/series.rst index 41705620d4bc7..58351bab07b22 100644 --- a/doc/source/reference/series.rst +++ b/doc/source/reference/series.rst @@ -273,6 +273,19 @@ pandas provides dtype-specific methods under various accessors. These are separate namespaces within :class:`Series` that only apply to specific data types. +.. autosummary:: + :toctree: api/ + :nosignatures: + :template: autosummary/accessor.rst + + Series.str + Series.cat + Series.dt + Series.sparse + DataFrame.sparse + Index.str + + =========================== ================================= Data Type Accessor =========================== ================================= @@ -458,22 +471,6 @@ strings and apply several methods to it. These can be accessed like Series.str.isdecimal Series.str.get_dummies -.. - The following is needed to ensure the generated pages are created with the - correct template (otherwise they would be created in the Series/Index class page) - -.. - .. autosummary:: - :toctree: api/ - :template: autosummary/accessor.rst - - Series.str - Series.cat - Series.dt - Series.sparse - DataFrame.sparse - Index.str - .. _api.series.cat: Categorical accessor