DEPR: allowing unknowns in take by jbrockmendel · Pull Request #52981 · pandas-dev/pandas (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation9 Commits3 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
- closes #xxxx (Replace xxxx with the GitHub issue number)
- Tests added and passed if fixing a bug or adding a new feature
- All code checks passed.
- Added type annotations to new arguments/methods/functions.
- Added an entry in the latest
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.
What's the motivation for this change?
is_array_like is an antipattern #52834
Seems pretty heavy to deprecate this usage just to avoid is_array_like
, especially since numpy.take will accept array-likes. Why can't we just replace not is_array_like
with not isinstance(..., (np.ndarray, ...))
and accept we may be calling asarray
on more items?
Why can't we just replace not is_array_like with not isinstance(..., (np.ndarray, ...)) and accept we may be calling asarray on more items?
That's a reasonable intuition, but np.asarray can have weird behaviors which we generally work around (but unfortunately have several slightly-different implementations of). My thought is to avoid that by just having the user do that casting.
But we'll still allow e.g. a list in DataFrame.take and others? This seems inconsistent.
But we'll still allow e.g. a list in DataFrame.take and others? This seems inconsistent.
This is for the first arg in take, not the indices.
I personally wouldn't expect pandas to implement taking from a general sequence (e.g. a list); I'm okay with deprecating from that perspective.
topper-123 pushed a commit to topper-123/pandas that referenced this pull request
DEPR: allowing unknowns in take
GH ref
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request
DEPR: allowing unknowns in take
GH ref