Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Fix Docstring Errors for pandas.api.extensions.ExtensionArray #58540

Merged
merged 7 commits into from
May 2, 2024
5 changes: 0 additions & 5 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,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