-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Open
Labels
ExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Typingtype annotations, mypy/pyright type checkingtype annotations, mypy/pyright type checking
Description
In pandas/_typing.py, we define ArrayLike as:
ArrayLike = Union["ExtensionArray", np.ndarray]In the numpy glossary https://numpy.org/doc/stable/glossary.html?highlight=array_like, numpy defines array_like as:
Any scalar or sequence that can be interpreted as an ndarray. In addition to ndarrays and scalars this category includes lists (possibly nested and with different element types) and tuples. Any argument accepted by numpy.array is array_like.
Are we creating confusion by using the term ArrayLike to only mean arrays, whereas numpy defines it to include scalars?
This came up in terms of reconciling the arguments of np.searchsorted() and ExtensionArray.searchsorted().
Comments from @jbrockmendel and @simonjayhawkins welcome.
Metadata
Metadata
Assignees
Labels
ExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Typingtype annotations, mypy/pyright type checkingtype annotations, mypy/pyright type checking