Skip to content

Commit b5bceb7

Browse files
authored
DOC: update array-like parameters if scalars accepted (#41985)
1 parent 949592a commit b5bceb7

File tree

7 files changed

+39
-39
lines changed

7 files changed

+39
-39
lines changed

pandas/core/algorithms.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def factorize_array(
531531
mask: np.ndarray | None = None,
532532
) -> tuple[npt.NDArray[np.intp], np.ndarray]:
533533
"""
534-
Factorize an array-like to codes and uniques.
534+
Factorize a numpy array to codes and uniques.
535535
536536
This doesn't do any coercion of types or unboxing before factorization.
537537
@@ -910,7 +910,7 @@ def duplicated(
910910
911911
Parameters
912912
----------
913-
values : ndarray-like
913+
values : nd.array, ExtensionArray or Series
914914
Array over which to check for duplicate values.
915915
keep : {'first', 'last', False}, default 'first'
916916
- ``first`` : Mark duplicates as ``True`` except for the first
@@ -1412,8 +1412,8 @@ def take(
14121412
14131413
Parameters
14141414
----------
1415-
arr : sequence
1416-
Non array-likes (sequences without a dtype) are coerced
1415+
arr : array-like or scalar value
1416+
Non array-likes (sequences/scalars without a dtype) are coerced
14171417
to an ndarray.
14181418
indices : sequence of integers
14191419
Indices to be taken.
@@ -1523,11 +1523,11 @@ def searchsorted(arr, value, side="left", sorter=None) -> np.ndarray:
15231523
15241524
Parameters
15251525
----------
1526-
arr: array-like
1526+
arr: np.ndarray, ExtensionArray, Series
15271527
Input array. If `sorter` is None, then it must be sorted in
15281528
ascending order, otherwise `sorter` must be an array of indices
15291529
that sort it.
1530-
value : array-like
1530+
value : array-like or scalar
15311531
Values to insert into `arr`.
15321532
side : {'left', 'right'}, optional
15331533
If 'left', the index of the first suitable location found is given.

pandas/core/arrays/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,8 @@ def searchsorted(self, value, side="left", sorter=None):
826826
827827
Parameters
828828
----------
829-
value : array-like
830-
Values to insert into `self`.
829+
value : array-like, list or scalar
830+
Value(s) to insert into `self`.
831831
side : {'left', 'right'}, optional
832832
If 'left', the index of the first suitable location found is given.
833833
If 'right', return the last such index. If there is no suitable

pandas/core/arrays/sparse/array.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class SparseArray(OpsMixin, PandasObject, ExtensionArray):
226226
227227
Parameters
228228
----------
229-
data : array-like
229+
data : array-like or scalar
230230
A dense array of values to store in the SparseArray. This may contain
231231
`fill_value`.
232232
sparse_index : SparseIndex, optional

pandas/core/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ def factorize(self, sort: bool = False, na_sentinel: int | None = -1):
11371137
11381138
Parameters
11391139
----------
1140-
value : array-like
1140+
value : array-like or scalar
11411141
Values to insert into `self`.
11421142
side : {{'left', 'right'}}, optional
11431143
If 'left', the index of the first suitable location found is given.

pandas/core/dtypes/common.py

+26-26
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def is_object_dtype(arr_or_dtype) -> bool:
162162
163163
Parameters
164164
----------
165-
arr_or_dtype : array-like
165+
arr_or_dtype : array-like or dtype
166166
The array-like or dtype to check.
167167
168168
Returns
@@ -316,7 +316,7 @@ def is_datetime64_dtype(arr_or_dtype) -> bool:
316316
317317
Parameters
318318
----------
319-
arr_or_dtype : array-like
319+
arr_or_dtype : array-like or dtype
320320
The array-like or dtype to check.
321321
322322
Returns
@@ -349,7 +349,7 @@ def is_datetime64tz_dtype(arr_or_dtype) -> bool:
349349
350350
Parameters
351351
----------
352-
arr_or_dtype : array-like
352+
arr_or_dtype : array-like or dtype
353353
The array-like or dtype to check.
354354
355355
Returns
@@ -390,7 +390,7 @@ def is_timedelta64_dtype(arr_or_dtype) -> bool:
390390
391391
Parameters
392392
----------
393-
arr_or_dtype : array-like
393+
arr_or_dtype : array-like or dtype
394394
The array-like or dtype to check.
395395
396396
Returns
@@ -424,7 +424,7 @@ def is_period_dtype(arr_or_dtype) -> bool:
424424
425425
Parameters
426426
----------
427-
arr_or_dtype : array-like
427+
arr_or_dtype : array-like or dtype
428428
The array-like or dtype to check.
429429
430430
Returns
@@ -460,7 +460,7 @@ def is_interval_dtype(arr_or_dtype) -> bool:
460460
461461
Parameters
462462
----------
463-
arr_or_dtype : array-like
463+
arr_or_dtype : array-like or dtype
464464
The array-like or dtype to check.
465465
466466
Returns
@@ -498,7 +498,7 @@ def is_categorical_dtype(arr_or_dtype) -> bool:
498498
499499
Parameters
500500
----------
501-
arr_or_dtype : array-like
501+
arr_or_dtype : array-like or dtype
502502
The array-like or dtype to check.
503503
504504
Returns
@@ -534,7 +534,7 @@ def is_string_dtype(arr_or_dtype) -> bool:
534534
535535
Parameters
536536
----------
537-
arr_or_dtype : array-like
537+
arr_or_dtype : array-like or dtype
538538
The array or dtype to check.
539539
540540
Returns
@@ -635,7 +635,7 @@ def is_any_int_dtype(arr_or_dtype) -> bool:
635635
636636
Parameters
637637
----------
638-
arr_or_dtype : array-like
638+
arr_or_dtype : array-like or dtype
639639
The array or dtype to check.
640640
641641
Returns
@@ -680,7 +680,7 @@ def is_integer_dtype(arr_or_dtype) -> bool:
680680
681681
Parameters
682682
----------
683-
arr_or_dtype : array-like
683+
arr_or_dtype : array-like or dtype
684684
The array or dtype to check.
685685
686686
Returns
@@ -732,7 +732,7 @@ def is_signed_integer_dtype(arr_or_dtype) -> bool:
732732
733733
Parameters
734734
----------
735-
arr_or_dtype : array-like
735+
arr_or_dtype : array-like or dtype
736736
The array or dtype to check.
737737
738738
Returns
@@ -784,7 +784,7 @@ def is_unsigned_integer_dtype(arr_or_dtype) -> bool:
784784
785785
Parameters
786786
----------
787-
arr_or_dtype : array-like
787+
arr_or_dtype : array-like or dtype
788788
The array or dtype to check.
789789
790790
Returns
@@ -828,7 +828,7 @@ def is_int64_dtype(arr_or_dtype) -> bool:
828828
829829
Parameters
830830
----------
831-
arr_or_dtype : array-like
831+
arr_or_dtype : array-like or dtype
832832
The array or dtype to check.
833833
834834
Returns
@@ -878,7 +878,7 @@ def is_datetime64_any_dtype(arr_or_dtype) -> bool:
878878
879879
Parameters
880880
----------
881-
arr_or_dtype : array-like
881+
arr_or_dtype : array-like or dtype
882882
The array or dtype to check.
883883
884884
Returns
@@ -920,7 +920,7 @@ def is_datetime64_ns_dtype(arr_or_dtype) -> bool:
920920
921921
Parameters
922922
----------
923-
arr_or_dtype : array-like
923+
arr_or_dtype : array-like or dtype
924924
The array or dtype to check.
925925
926926
Returns
@@ -970,7 +970,7 @@ def is_timedelta64_ns_dtype(arr_or_dtype) -> bool:
970970
971971
Parameters
972972
----------
973-
arr_or_dtype : array-like
973+
arr_or_dtype : array-like or dtype
974974
The array or dtype to check.
975975
976976
Returns
@@ -999,7 +999,7 @@ def is_datetime_or_timedelta_dtype(arr_or_dtype) -> bool:
999999
10001000
Parameters
10011001
----------
1002-
arr_or_dtype : array-like
1002+
arr_or_dtype : array-like or dtype
10031003
The array or dtype to check.
10041004
10051005
Returns
@@ -1039,7 +1039,7 @@ def is_numeric_v_string_like(a: ArrayLike, b):
10391039
10401040
Parameters
10411041
----------
1042-
a : array-like
1042+
a : array-like, scalar
10431043
The first object to check.
10441044
b : array-like, scalar
10451045
The second object to check.
@@ -1146,7 +1146,7 @@ def needs_i8_conversion(arr_or_dtype) -> bool:
11461146
11471147
Parameters
11481148
----------
1149-
arr_or_dtype : array-like
1149+
arr_or_dtype : array-like or dtype
11501150
The array or dtype to check.
11511151
11521152
Returns
@@ -1190,7 +1190,7 @@ def is_numeric_dtype(arr_or_dtype) -> bool:
11901190
11911191
Parameters
11921192
----------
1193-
arr_or_dtype : array-like
1193+
arr_or_dtype : array-like or dtype
11941194
The array or dtype to check.
11951195
11961196
Returns
@@ -1234,7 +1234,7 @@ def is_float_dtype(arr_or_dtype) -> bool:
12341234
12351235
Parameters
12361236
----------
1237-
arr_or_dtype : array-like
1237+
arr_or_dtype : array-like or dtype
12381238
The array or dtype to check.
12391239
12401240
Returns
@@ -1266,7 +1266,7 @@ def is_bool_dtype(arr_or_dtype) -> bool:
12661266
12671267
Parameters
12681268
----------
1269-
arr_or_dtype : array-like
1269+
arr_or_dtype : array-like or dtype
12701270
The array or dtype to check.
12711271
12721272
Returns
@@ -1337,7 +1337,7 @@ def is_extension_type(arr) -> bool:
13371337
13381338
Parameters
13391339
----------
1340-
arr : array-like
1340+
arr : array-like, scalar
13411341
The array-like to check.
13421342
13431343
Returns
@@ -1489,7 +1489,7 @@ def is_complex_dtype(arr_or_dtype) -> bool:
14891489
14901490
Parameters
14911491
----------
1492-
arr_or_dtype : array-like
1492+
arr_or_dtype : array-like or dtype
14931493
The array or dtype to check.
14941494
14951495
Returns
@@ -1546,7 +1546,7 @@ def get_dtype(arr_or_dtype) -> DtypeObj:
15461546
15471547
Parameters
15481548
----------
1549-
arr_or_dtype : array-like
1549+
arr_or_dtype : array-like or dtype
15501550
The array-like or dtype object whose dtype we want to extract.
15511551
15521552
Returns
@@ -1580,7 +1580,7 @@ def _is_dtype_type(arr_or_dtype, condition) -> bool:
15801580
15811581
Parameters
15821582
----------
1583-
arr_or_dtype : array-like
1583+
arr_or_dtype : array-like or dtype
15841584
The array-like or dtype object whose dtype we want to extract.
15851585
condition : callable[Union[np.dtype, ExtensionDtypeType]]
15861586

pandas/core/indexes/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6129,7 +6129,7 @@ def drop(self, labels, errors: str_t = "raise") -> Index:
61296129
61306130
Parameters
61316131
----------
6132-
labels : array-like
6132+
labels : array-like or scalar
61336133
errors : {'ignore', 'raise'}, default 'raise'
61346134
If 'ignore', suppress error and existing labels are dropped.
61356135

pandas/core/internals/blocks.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ def setitem(self, indexer, value):
886886
887887
Parameters
888888
----------
889-
indexer : tuple, list-like, array-like, slice
889+
indexer : tuple, list-like, array-like, slice, int
890890
The subset of self.values to set
891891
value : object
892892
The value being set
@@ -1450,7 +1450,7 @@ def setitem(self, indexer, value):
14501450
14511451
Parameters
14521452
----------
1453-
indexer : tuple, list-like, array-like, slice
1453+
indexer : tuple, list-like, array-like, slice, int
14541454
The subset of self.values to set
14551455
value : object
14561456
The value being set

0 commit comments

Comments
 (0)