diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 5fc8f02a3fa8d..c63435b257032 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -99,7 +99,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.api.extensions.ExtensionDtype \ pandas.api.extensions.ExtensionArray \ pandas.arrays.NumpyExtensionArray \ - pandas.api.extensions.ExtensionArray._accumulate \ pandas.api.extensions.ExtensionArray._concat_same_type \ pandas.api.extensions.ExtensionArray._formatter \ pandas.api.extensions.ExtensionArray._from_factorized \ @@ -110,9 +109,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.api.extensions.ExtensionArray._values_for_factorize \ pandas.api.extensions.ExtensionArray.interpolate \ pandas.api.extensions.ExtensionArray.ravel \ - pandas.api.extensions.ExtensionArray.ndim \ - pandas.api.extensions.ExtensionArray.shape \ - pandas.api.extensions.ExtensionArray.tolist \ pandas.DataFrame.__dataframe__ RET=$(($RET + $?)) ; echo $MSG "DONE" diff --git a/pandas/core/arrays/base.py b/pandas/core/arrays/base.py index ca95451575af5..2e409463ecb81 100644 --- a/pandas/core/arrays/base.py +++ b/pandas/core/arrays/base.py @@ -520,6 +520,12 @@ def dtype(self) -> ExtensionDtype: def shape(self) -> Shape: """ Return a tuple of the array dimensions. + + Examples + -------- + >>> arr = pd.array([1, 2, 3]) + >>> arr.shape + (3,) """ return (len(self),) @@ -536,6 +542,12 @@ def size(self) -> int: def ndim(self) -> int: """ Extension Arrays are only allowed to be 1-dimensional. + + Examples + -------- + >>> arr = pd.array([1, 2, 3]) + >>> arr.ndim + 1 """ return 1 @@ -1599,6 +1611,14 @@ def _accumulate( Raises ------ NotImplementedError : subclass does not define accumulations + + Examples + -------- + >>> arr = pd.array([1, 2, 3]) + >>> arr._accumulate(name='cumsum') + + [1, 3, 6] + Length: 3, dtype: Int64 """ raise NotImplementedError(f"cannot perform {name} with type {self.dtype}") @@ -1694,6 +1714,12 @@ def tolist(self) -> list: Returns ------- list + + Examples + -------- + >>> arr = pd.array([1, 2, 3]) + >>> arr.tolist() + [1, 2, 3] """ if self.ndim > 1: return [x.tolist() for x in self]