From 11fbd969bfd9e1d5e1e968dc14ca50d0cad77dfb Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Thu, 13 Jun 2019 19:46:03 +0200 Subject: [PATCH 1/2] DOC: array class docstring pages without autosummary tables --- doc/source/reference/arrays.rst | 29 +++++++++++++++++++++++++++++ doc/source/reference/extensions.rst | 5 +++++ pandas/core/arrays/datetimes.py | 8 ++++++++ pandas/core/arrays/integer.py | 8 ++++++++ pandas/core/arrays/numpy_.py | 8 ++++++++ pandas/core/arrays/period.py | 8 ++++++++ pandas/core/arrays/sparse.py | 8 ++++++++ pandas/core/arrays/timedeltas.py | 8 ++++++++ 8 files changed, 82 insertions(+) diff --git a/doc/source/reference/arrays.rst b/doc/source/reference/arrays.rst index fb9a95b6736d5..38406bf5b2656 100644 --- a/doc/source/reference/arrays.rst +++ b/doc/source/reference/arrays.rst @@ -144,6 +144,7 @@ If the data are tz-aware, then every value in the array must have the same timez .. autosummary:: :toctree: api/ + :template: autosummary/class_without_autosummary.rst arrays.DatetimeArray @@ -204,6 +205,7 @@ A collection of timedeltas may be stored in a :class:`TimedeltaArray`. .. autosummary:: :toctree: api/ + :template: autosummary/class_without_autosummary.rst arrays.TimedeltaArray @@ -263,6 +265,7 @@ Every period in a ``PeriodArray`` must have the same ``freq``. .. autosummary:: :toctree: api/ + :template: autosummary/class_without_autosummary.rst arrays.PeriodArray @@ -304,6 +307,7 @@ A collection of intervals may be stored in an :class:`arrays.IntervalArray`. .. autosummary:: :toctree: api/ + :template: autosummary/class_without_autosummary.rst arrays.IntervalArray @@ -313,6 +317,29 @@ A collection of intervals may be stored in an :class:`arrays.IntervalArray`. IntervalDtype + +.. Those attributes and methods are included in the API because the docstrings +.. of IntervalIndex and IntervalArray are shared. Including it here to make +.. sure a docstring page is built for them to avoid warnings + +.. + .. autosummary:: + :toctree: api/ + + arrays.IntervalArray.left + arrays.IntervalArray.right + arrays.IntervalArray.closed + arrays.IntervalArray.mid + arrays.IntervalArray.length + arrays.IntervalArray.is_non_overlapping_monotonic + arrays.IntervalArray.from_arrays + arrays.IntervalArray.from_tuples + arrays.IntervalArray.from_breaks + arrays.IntervalArray.overlaps + arrays.IntervalArray.set_closed + arrays.IntervalArray.to_tuples + + .. _api.arrays.integer_na: Nullable Integer @@ -323,6 +350,7 @@ Pandas provides this through :class:`arrays.IntegerArray`. .. autosummary:: :toctree: api/ + :template: autosummary/class_without_autosummary.rst arrays.IntegerArray @@ -414,6 +442,7 @@ be stored efficiently as a :class:`SparseArray`. .. autosummary:: :toctree: api/ + :template: autosummary/class_without_autosummary.rst SparseArray diff --git a/doc/source/reference/extensions.rst b/doc/source/reference/extensions.rst index 6146e34fab274..34f76642119c8 100644 --- a/doc/source/reference/extensions.rst +++ b/doc/source/reference/extensions.rst @@ -19,4 +19,9 @@ objects. api.extensions.register_index_accessor api.extensions.ExtensionDtype api.extensions.ExtensionArray + +.. autosummary:: + :toctree: api/ + :template: autosummary/class_without_autosummary.rst + arrays.PandasArray diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index bf7bd0668595d..47aef3c84c9f7 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -236,6 +236,14 @@ class DatetimeArray(dtl.DatetimeLikeArrayMixin, freq : str or Offset, optional copy : bool, default False Whether to copy the underlying array of values. + + Attributes + ---------- + None + + Methods + ------- + None """ _typ = "datetimearray" _scalar_type = Timestamp diff --git a/pandas/core/arrays/integer.py b/pandas/core/arrays/integer.py index 29337b7f76131..b70af695a97db 100644 --- a/pandas/core/arrays/integer.py +++ b/pandas/core/arrays/integer.py @@ -269,6 +269,14 @@ class IntegerArray(ExtensionArray, ExtensionOpsMixin): [1, NaN, 3] Length: 3, dtype: UInt16 + + Attributes + ---------- + None + + Methods + ------- + None """ @cache_readonly diff --git a/pandas/core/arrays/numpy_.py b/pandas/core/arrays/numpy_.py index 0deefd2b10b6e..f651f89fab834 100644 --- a/pandas/core/arrays/numpy_.py +++ b/pandas/core/arrays/numpy_.py @@ -98,6 +98,14 @@ class PandasArray(ExtensionArray, ExtensionOpsMixin, NDArrayOperatorsMixin): The NumPy ndarray to wrap. Must be 1-dimensional. copy : bool, default False Whether to copy `values`. + + Attributes + ---------- + None + + Methods + ------- + None """ # If you're wondering why pd.Series(cls) doesn't put the array in an # ExtensionBlock, search for `ABCPandasArray`. We check for diff --git a/pandas/core/arrays/period.py b/pandas/core/arrays/period.py index a6e282462af68..eb43440659811 100644 --- a/pandas/core/arrays/period.py +++ b/pandas/core/arrays/period.py @@ -129,6 +129,14 @@ class PeriodArray(dtl.DatetimeLikeArrayMixin, dtl.DatelikeOps): The `freq` indicates the span covered by each element of the array. All elements in the PeriodArray have the same `freq`. + + Attributes + ---------- + None + + Methods + ------- + None """ # array priority higher than numpy scalars __array_priority__ = 1000 diff --git a/pandas/core/arrays/sparse.py b/pandas/core/arrays/sparse.py index ca6e2c04f5a69..5e636b5105e56 100644 --- a/pandas/core/arrays/sparse.py +++ b/pandas/core/arrays/sparse.py @@ -572,6 +572,14 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin): this determines ``self.sp_values`` and ``self.fill_value``. copy : bool, default False Whether to explicitly copy the incoming `data` array. + + Attributes + ---------- + None + + Methods + ------- + None """ _pandas_ftype = 'sparse' diff --git a/pandas/core/arrays/timedeltas.py b/pandas/core/arrays/timedeltas.py index 3ba6829b4ac28..50bc8d6d3ae6b 100644 --- a/pandas/core/arrays/timedeltas.py +++ b/pandas/core/arrays/timedeltas.py @@ -127,6 +127,14 @@ class TimedeltaArray(dtl.DatetimeLikeArrayMixin, dtl.TimelikeOps): freq : Offset, optional copy : bool, default False Whether to copy the underlying array of data. + + Attributes + ---------- + None + + Methods + ------- + None """ _typ = "timedeltaarray" _scalar_type = Timedelta From 7ad3b5def7a3222652c0a898493a45f7f02a82ee Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 14 Jun 2019 00:10:15 +0200 Subject: [PATCH 2/2] fix order --- pandas/core/arrays/integer.py | 16 ++++++++-------- pandas/core/arrays/period.py | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pandas/core/arrays/integer.py b/pandas/core/arrays/integer.py index b70af695a97db..589e98f016f69 100644 --- a/pandas/core/arrays/integer.py +++ b/pandas/core/arrays/integer.py @@ -244,6 +244,14 @@ class IntegerArray(ExtensionArray, ExtensionOpsMixin): copy : bool, default False Whether to copy the `values` and `mask`. + Attributes + ---------- + None + + Methods + ------- + None + Returns ------- IntegerArray @@ -269,14 +277,6 @@ class IntegerArray(ExtensionArray, ExtensionOpsMixin): [1, NaN, 3] Length: 3, dtype: UInt16 - - Attributes - ---------- - None - - Methods - ------- - None """ @cache_readonly diff --git a/pandas/core/arrays/period.py b/pandas/core/arrays/period.py index eb43440659811..ece05567d3343 100644 --- a/pandas/core/arrays/period.py +++ b/pandas/core/arrays/period.py @@ -112,6 +112,14 @@ class PeriodArray(dtl.DatetimeLikeArrayMixin, dtl.DatelikeOps): copy : bool, default False Whether to copy the ordinals before storing. + Attributes + ---------- + None + + Methods + ------- + None + See Also -------- period_array : Create a new PeriodArray. @@ -129,14 +137,6 @@ class PeriodArray(dtl.DatetimeLikeArrayMixin, dtl.DatelikeOps): The `freq` indicates the span covered by each element of the array. All elements in the PeriodArray have the same `freq`. - - Attributes - ---------- - None - - Methods - ------- - None """ # array priority higher than numpy scalars __array_priority__ = 1000