diff --git a/doc/source/user_guide/timeseries.rst b/doc/source/user_guide/timeseries.rst index 97be46e338c09..fb1c37c1b9073 100644 --- a/doc/source/user_guide/timeseries.rst +++ b/doc/source/user_guide/timeseries.rst @@ -1299,6 +1299,31 @@ frequencies. We will refer to these aliases as *offset aliases*. given frequency it will roll to the next value for ``start_date`` (respectively previous for the ``end_date``) +.. _timeseries.period_aliases: + +Period aliases +~~~~~~~~~~~~~~ + +A number of string aliases are given to useful common time series +frequencies. We will refer to these aliases as *period aliases*. + +.. csv-table:: + :header: "Alias", "Description" + :widths: 15, 100 + + "B", "business day frequency" + "D", "calendar day frequency" + "W", "weekly frequency" + "M", "monthly frequency" + "Q", "quarterly frequency" + "A, Y", "yearly frequency" + "H", "hourly frequency" + "T, min", "minutely frequency" + "S", "secondly frequency" + "L, ms", "milliseconds" + "U, us", "microseconds" + "N", "nanoseconds" + Combining aliases ~~~~~~~~~~~~~~~~~ @@ -2083,7 +2108,7 @@ Period dtypes dtype similar to the :ref:`timezone aware dtype ` (``datetime64[ns, tz]``). The ``period`` dtype holds the ``freq`` attribute and is represented with -``period[freq]`` like ``period[D]`` or ``period[M]``, using :ref:`frequency strings `. +``period[freq]`` like ``period[D]`` or ``period[M]``, using :ref:`frequency strings `. .. ipython:: python diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index 28b56a220f005..3d083e55b12ab 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -1145,13 +1145,13 @@ def to_period(self, freq=None) -> PeriodArray: Parameters ---------- - freq : str or Offset, optional - One of pandas' :ref:`offset strings ` - or an Offset object. Will be inferred by default. + freq : str or Period, optional + One of pandas' :ref:`period aliases ` + or an Period object. Will be inferred by default. Returns ------- - PeriodArray/Index + PeriodArray/PeriodIndex Raises ------