Skip to content

Commit 09a5933

Browse files
DOC: fix api documentation for accessors
1 parent f4d288f commit 09a5933

File tree

3 files changed

+54
-12
lines changed

3 files changed

+54
-12
lines changed
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{ fullname }}
2+
{{ underline }}
3+
4+
.. currentmodule:: {{ module.split('.')[0] }}
5+
6+
.. automethod:: {{ [module.split('.')[1], objname]|join('.') }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{ fullname }}
2+
{{ underline }}
3+
4+
.. currentmodule:: {{ module }}
5+
6+
.. autoclass:: {{ objname }}

doc/source/api.rst

+42-12
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ These can be accessed like ``Series.dt.<property>``.
470470
Series.dt.microsecond
471471
Series.dt.nanosecond
472472
Series.dt.second
473+
Series.dt.week
473474
Series.dt.weekofyear
474475
Series.dt.dayofweek
475476
Series.dt.weekday
@@ -481,6 +482,10 @@ These can be accessed like ``Series.dt.<property>``.
481482
Series.dt.is_quarter_end
482483
Series.dt.is_year_start
483484
Series.dt.is_year_end
485+
Series.dt.daysinmonth
486+
Series.dt.days_in_month
487+
Series.dt.tz
488+
Series.dt.freq
484489

485490
**Datetime Methods**
486491

@@ -575,29 +580,49 @@ strings and apply several methods to it. These can be acccessed like
575580
Series.str.isdecimal
576581
Series.str.get_dummies
577582

583+
..
584+
The following is needed to ensure the generated pages are created with the
585+
correct template (otherwise they would be created in the Series class page)
586+
587+
..
588+
.. autosummary::
589+
:toctree: generated/
590+
:template: autosummary/accessor.rst
591+
592+
Series.str
593+
Series.cat
594+
Series.dt
595+
596+
578597
.. _api.categorical:
579598

580599
Categorical
581600
~~~~~~~~~~~
582601

583602
If the Series is of dtype ``category``, ``Series.cat`` can be used to change the the categorical
584603
data. This accessor is similar to the ``Series.dt`` or ``Series.str`` and has the
585-
following usable methods and properties (all available as ``Series.cat.<method_or_property>``).
604+
following usable methods and properties:
605+
606+
.. autosummary::
607+
:toctree: generated/
608+
:template: autosummary/accessor_attribute.rst
609+
610+
Series.cat.categories
611+
Series.cat.ordered
612+
Series.cat.codes
586613

587614
.. autosummary::
588615
:toctree: generated/
616+
:template: autosummary/accessor_method.rst
589617

590-
Categorical.categories
591-
Categorical.ordered
592-
Categorical.rename_categories
593-
Categorical.reorder_categories
594-
Categorical.add_categories
595-
Categorical.remove_categories
596-
Categorical.remove_unused_categories
597-
Categorical.set_categories
598-
Categorical.as_ordered
599-
Categorical.as_unordered
600-
Categorical.codes
618+
Series.cat.rename_categories
619+
Series.cat.reorder_categories
620+
Series.cat.add_categories
621+
Series.cat.remove_categories
622+
Series.cat.remove_unused_categories
623+
Series.cat.set_categories
624+
Series.cat.as_ordered
625+
Series.cat.as_unordered
601626

602627
To create a Series of dtype ``category``, use ``cat = s.astype("category")``.
603628

@@ -606,8 +631,13 @@ adding ordering information or special categories is need at creation time of th
606631

607632
.. autosummary::
608633
:toctree: generated/
634+
:template: autosummary/class_without_autosummary.rst
609635

610636
Categorical
637+
638+
.. autosummary::
639+
:toctree: generated/
640+
611641
Categorical.from_codes
612642

613643
``np.asarray(categorical)`` works by implementing the array interface. Be aware, that this converts

0 commit comments

Comments
 (0)