Skip to content

Commit

Permalink
DOC: Fix Docstring Errors for pandas.api.extensions.ExtensionArray (#…
Browse files Browse the repository at this point in the history
…58540)

* fix line too long

* fix docstring errors for pandas.api.extensions.ExtensionArray._accumulate

* fix SA01 error for pandas.api.extensions.ExtensionArray._concat_same_type

* fix PR07 error for pandas.api.extensions.ExtensionArray._concat_same_type

* fix docstring issues for pandas.api.extensions.ExtensionArray._formatter

* delete extra lines

* docstring errors fixed for pandas.api.extensions.ExtensionArray._from_sequence
  • Loading branch information
gboeker committed May 2, 2024
1 parent d9a02be commit 3829c94
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
5 changes: 0 additions & 5 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timestamp.weekday SA01" \
-i "pandas.Timestamp.weekofyear SA01" \
-i "pandas.Timestamp.year GL08" \
-i "pandas.api.extensions.ExtensionArray SA01" \
-i "pandas.api.extensions.ExtensionArray._accumulate RT03,SA01" \
-i "pandas.api.extensions.ExtensionArray._concat_same_type PR07,SA01" \
-i "pandas.api.extensions.ExtensionArray._formatter SA01" \
-i "pandas.api.extensions.ExtensionArray._from_sequence SA01" \
-i "pandas.api.extensions.ExtensionArray._from_sequence_of_strings SA01" \
-i "pandas.api.extensions.ExtensionArray._hash_pandas_object RT03,SA01" \
-i "pandas.api.extensions.ExtensionArray._pad_or_backfill PR01,RT03,SA01" \
Expand Down
43 changes: 43 additions & 0 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ class ExtensionArray:
_values_for_argsort
_values_for_factorize
See Also
--------
api.extensions.ExtensionDtype : A custom data type, to be paired with an
ExtensionArray.
api.extensions.ExtensionArray.dtype : An instance of ExtensionDtype.
Notes
-----
The interface includes the following abstract methods that must be
Expand Down Expand Up @@ -289,6 +295,13 @@ def _from_sequence(
-------
ExtensionArray
See Also
--------
api.extensions.ExtensionArray._from_sequence_of_strings : Construct a new
ExtensionArray from a sequence of strings.
api.extensions.ExtensionArray._hash_pandas_object : Hook for
hash_pandas_object.
Examples
--------
>>> pd.arrays.IntegerArray._from_sequence([4, 5])
Expand Down Expand Up @@ -1707,6 +1720,17 @@ def _formatter(self, boxed: bool = False) -> Callable[[Any], str | None]:
when ``boxed=False`` and :func:`str` is used when
``boxed=True``.
See Also
--------
api.extensions.ExtensionArray._concat_same_type : Concatenate multiple
array of this dtype.
api.extensions.ExtensionArray._explode : Transform each element of
list-like to a row.
api.extensions.ExtensionArray._from_factorized : Reconstruct an
ExtensionArray after factorization.
api.extensions.ExtensionArray._from_sequence : Construct a new
ExtensionArray from a sequence of scalars.
Examples
--------
>>> class MyExtensionArray(pd.arrays.NumpyExtensionArray):
Expand Down Expand Up @@ -1783,11 +1807,21 @@ def _concat_same_type(cls, to_concat: Sequence[Self]) -> Self:
Parameters
----------
to_concat : sequence of this type
An array of the same dtype to concatenate.
Returns
-------
ExtensionArray
See Also
--------
api.extensions.ExtensionArray._explode : Transform each element of
list-like to a row.
api.extensions.ExtensionArray._formatter : Formatting function for
scalar values.
api.extensions.ExtensionArray._from_factorized : Reconstruct an
ExtensionArray after factorization.
Examples
--------
>>> arr1 = pd.array([1, 2, 3])
Expand Down Expand Up @@ -1838,11 +1872,20 @@ def _accumulate(
Returns
-------
array
An array performing the accumulation operation.
Raises
------
NotImplementedError : subclass does not define accumulations
See Also
--------
api.extensions.ExtensionArray._concat_same_type : Concatenate multiple
array of this dtype.
api.extensions.ExtensionArray.view : Return a view on the array.
api.extensions.ExtensionArray._explode : Transform each element of
list-like to a row.
Examples
--------
>>> arr = pd.array([1, 2, 3])
Expand Down

0 comments on commit 3829c94

Please sign in to comment.