diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index bf6887ed27005..df9f3d07ce7fd 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -531,7 +531,7 @@ def factorize_array( mask: np.ndarray | None = None, ) -> tuple[npt.NDArray[np.intp], np.ndarray]: """ - Factorize an array-like to codes and uniques. + Factorize a numpy array to codes and uniques. This doesn't do any coercion of types or unboxing before factorization. @@ -910,7 +910,7 @@ def duplicated( Parameters ---------- - values : ndarray-like + values : nd.array, ExtensionArray or Series Array over which to check for duplicate values. keep : {'first', 'last', False}, default 'first' - ``first`` : Mark duplicates as ``True`` except for the first @@ -1412,8 +1412,8 @@ def take( Parameters ---------- - arr : sequence - Non array-likes (sequences without a dtype) are coerced + arr : array-like or scalar value + Non array-likes (sequences/scalars without a dtype) are coerced to an ndarray. indices : sequence of integers Indices to be taken. @@ -1523,11 +1523,11 @@ def searchsorted(arr, value, side="left", sorter=None) -> np.ndarray: Parameters ---------- - arr: array-like + arr: np.ndarray, ExtensionArray, Series Input array. If `sorter` is None, then it must be sorted in ascending order, otherwise `sorter` must be an array of indices that sort it. - value : array-like + value : array-like or scalar Values to insert into `arr`. side : {'left', 'right'}, optional If 'left', the index of the first suitable location found is given. diff --git a/pandas/core/arrays/base.py b/pandas/core/arrays/base.py index 86a9eb9c4c32a..b362769f50fa8 100644 --- a/pandas/core/arrays/base.py +++ b/pandas/core/arrays/base.py @@ -826,8 +826,8 @@ def searchsorted(self, value, side="left", sorter=None): Parameters ---------- - value : array-like - Values to insert into `self`. + value : array-like, list or scalar + Value(s) to insert into `self`. side : {'left', 'right'}, optional If 'left', the index of the first suitable location found is given. If 'right', return the last such index. If there is no suitable diff --git a/pandas/core/arrays/sparse/array.py b/pandas/core/arrays/sparse/array.py index 18c79ccc56bad..b1cfcbd69a30b 100644 --- a/pandas/core/arrays/sparse/array.py +++ b/pandas/core/arrays/sparse/array.py @@ -226,7 +226,7 @@ class SparseArray(OpsMixin, PandasObject, ExtensionArray): Parameters ---------- - data : array-like + data : array-like or scalar A dense array of values to store in the SparseArray. This may contain `fill_value`. sparse_index : SparseIndex, optional diff --git a/pandas/core/base.py b/pandas/core/base.py index 430f1b57f0b87..9665b8b6af6ac 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -1137,7 +1137,7 @@ def factorize(self, sort: bool = False, na_sentinel: int | None = -1): Parameters ---------- - value : array-like + value : array-like or scalar Values to insert into `self`. side : {{'left', 'right'}}, optional If 'left', the index of the first suitable location found is given. diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index bda7584449983..08287cc296006 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -162,7 +162,7 @@ def is_object_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array-like or dtype to check. Returns @@ -316,7 +316,7 @@ def is_datetime64_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array-like or dtype to check. Returns @@ -349,7 +349,7 @@ def is_datetime64tz_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array-like or dtype to check. Returns @@ -390,7 +390,7 @@ def is_timedelta64_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array-like or dtype to check. Returns @@ -424,7 +424,7 @@ def is_period_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array-like or dtype to check. Returns @@ -460,7 +460,7 @@ def is_interval_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array-like or dtype to check. Returns @@ -498,7 +498,7 @@ def is_categorical_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array-like or dtype to check. Returns @@ -534,7 +534,7 @@ def is_string_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -635,7 +635,7 @@ def is_any_int_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -680,7 +680,7 @@ def is_integer_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -732,7 +732,7 @@ def is_signed_integer_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -784,7 +784,7 @@ def is_unsigned_integer_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -828,7 +828,7 @@ def is_int64_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -878,7 +878,7 @@ def is_datetime64_any_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -920,7 +920,7 @@ def is_datetime64_ns_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -970,7 +970,7 @@ def is_timedelta64_ns_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -999,7 +999,7 @@ def is_datetime_or_timedelta_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -1039,7 +1039,7 @@ def is_numeric_v_string_like(a: ArrayLike, b): Parameters ---------- - a : array-like + a : array-like, scalar The first object to check. b : array-like, scalar The second object to check. @@ -1146,7 +1146,7 @@ def needs_i8_conversion(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -1190,7 +1190,7 @@ def is_numeric_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -1234,7 +1234,7 @@ def is_float_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -1266,7 +1266,7 @@ def is_bool_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -1337,7 +1337,7 @@ def is_extension_type(arr) -> bool: Parameters ---------- - arr : array-like + arr : array-like, scalar The array-like to check. Returns @@ -1489,7 +1489,7 @@ def is_complex_dtype(arr_or_dtype) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array or dtype to check. Returns @@ -1546,7 +1546,7 @@ def get_dtype(arr_or_dtype) -> DtypeObj: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array-like or dtype object whose dtype we want to extract. Returns @@ -1580,7 +1580,7 @@ def _is_dtype_type(arr_or_dtype, condition) -> bool: Parameters ---------- - arr_or_dtype : array-like + arr_or_dtype : array-like or dtype The array-like or dtype object whose dtype we want to extract. condition : callable[Union[np.dtype, ExtensionDtypeType]] diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index d369624d30cdf..ac54038c271db 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -6129,7 +6129,7 @@ def drop(self, labels, errors: str_t = "raise") -> Index: Parameters ---------- - labels : array-like + labels : array-like or scalar errors : {'ignore', 'raise'}, default 'raise' If 'ignore', suppress error and existing labels are dropped. diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index 139eef5b05d11..ec2e49f560fe4 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -897,7 +897,7 @@ def setitem(self, indexer, value): Parameters ---------- - indexer : tuple, list-like, array-like, slice + indexer : tuple, list-like, array-like, slice, int The subset of self.values to set value : object The value being set @@ -1461,7 +1461,7 @@ def setitem(self, indexer, value): Parameters ---------- - indexer : tuple, list-like, array-like, slice + indexer : tuple, list-like, array-like, slice, int The subset of self.values to set value : object The value being set