8000 PERF: implement get_slice in cython by jbrockmendel · Pull Request #41045 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

PERF: implement get_slice in cython #41045

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 19 commits into from
Apr 19, 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
PERF: do validaton only if verify_integrity=True
  • Loading branch information
jbrockmendel committed Apr 2, 2021
commit bf89843929bb7809db2cd730bb092040c50f8ff5
21 changes: 11 additions & 10 deletions pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ def consolidate(self: T) -> T:
if self.is_consolidated():
return self

bm = type(self)(self.blocks, self.axes)
bm = type(self)(self.blocks, self.axes, verify_integrity=False)
bm._is_consolidated = False
bm._consolidate_inplace()
return bm
Expand Down Expand Up @@ -1360,16 +1360,17 @@ def __init__(
axes: Sequence[Index],
verify_integrity: bool = True,
):
assert all(isinstance(x, Index) for x in axes)

for block in blocks:
if self.ndim != block.ndim:
raise AssertionError(
f"Number of Block dimensions ({block.ndim}) must equal "
f"number of axes ({self.ndim})"
)

if verify_integrity:
assert all(isinstance(x, Index) for x in axes)

for block in blocks:
if self.ndim != block.ndim:
raise AssertionError(
f"Number of Block dimensions ({block.ndim}) must equal "
f"number of axes ({self.ndim})"
)

self._verify_integrity()

@classmethod
Expand Down Expand Up @@ -1407,7 +1408,7 @@ def get_slice(self, slobj: slice, axis: int = 0) -> BlockManager:
new_axes = list(self.axes)
new_axes[axis] = new_axes[axis]._getitem_slice(slobj)

return type(self)(tuple(new_blocks), new_axes)
return type(self)(tuple(new_blocks), new_axes, verify_integrity=False)

def iget(self, i: int) -> SingleBlockManager:
"""
Expand Down
0