8000 [ArrayManager] Indexing - implement iset by jorisvandenbossche · Pull Request #39734 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

[ArrayManager] Indexing - implement iset #39734

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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 15, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
limit to boolean mask if array
  • Loading branch information
jorisvandenbossche committed Feb 11, 2021
commit 5c0bb93a8aed8426276d4b443b033d88d0c1846a
10 changes: 4 additions & 6 deletions pandas/core/internals/array_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@ def iset(self, loc: Union[int, slice, np.ndarray], value):

Parameters
----------
loc : positional location (already bounds checked)
loc : integer, slice or boolean mask
Positional location (already bounds checked)
value : array-like
"""
# single column -> single integer index
Expand Down Expand Up @@ -692,11 +693,8 @@ def iset(self, loc: Union[int, slice, np.ndarray], value):
)
else:
assert isinstance(loc, np.ndarray)
if loc.dtype == "bool":
indices = np.nonzero(loc)[0]
else:
# TODO reachable?
indices = loc
assert loc.dtype == "bool"
indices = np.nonzero(loc)[0]

assert value.ndim == 2
assert value.shape[0] == len(self._axes[0])
Expand Down
0