Skip to content

CLN: unnecessary arg, declarations #43684

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 2 commits into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions pandas/_libs/index_class_helper.pxi.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ cdef class {{name}}Engine(IndexEngine):
# Returns ndarray[bool] or int
cdef:
ndarray[uint8_t, ndim=1, cast=True] indexer
ndarray[intp_t, ndim=1] found
ndarray[{{dtype}}_t, ndim=1] values
int count = 0

self._check_type(val)

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def unique(values):
"""
values = _ensure_arraylike(values)

if is_extension_array_dtype(values):
if is_extension_array_dtype(values.dtype):
# Dispatch to extension dtype's unique.
return values.unique()

Expand Down
18 changes: 5 additions & 13 deletions pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
type_t,
)
from pandas.errors import PerformanceWarning
from pandas.util._decorators import cache_readonly
from pandas.util._validators import validate_bool_kwarg

from pandas.core.dtypes.cast import infer_dtype_from_scalar
Expand Down Expand Up @@ -1706,7 +1707,7 @@ def unpickle_block(values, mgr_locs, ndim: int) -> Block:
def _post_setstate(self):
pass

@property
@cache_readonly
def _block(self) -> Block:
return self.blocks[0]

Expand All @@ -1729,7 +1730,7 @@ def getitem_mgr(self, indexer) -> SingleBlockManager:
raise ValueError("dimension-expanding indexing not allowed")

bp = BlockPlacement(slice(0, len(array)))
block = blk.make_block_same_class(array, placement=bp)
block = type(blk)(array, placement=bp, ndim=1)

new_idx = self.index[indexer]
return type(self)(block, new_idx)
Expand Down Expand Up @@ -1926,7 +1927,7 @@ def _form_blocks(arrays: list[ArrayLike], consolidate: bool) -> list[Block]:
tuples = list(enumerate(arrays))

if not consolidate:
nbs = _tuples_to_blocks_no_consolidate(tuples, dtype=None)
nbs = _tuples_to_blocks_no_consolidate(tuples)
return nbs

# group by dtype
Expand Down Expand Up @@ -1966,17 +1967,8 @@ def _form_blocks(arrays: list[ArrayLike], consolidate: bool) -> list[Block]:
return nbs


def _tuples_to_blocks_no_consolidate(tuples, dtype: DtypeObj | None) -> list[Block]:
def _tuples_to_blocks_no_consolidate(tuples) -> list[Block]:
# tuples produced within _form_blocks are of the form (placement, array)
if dtype is not None:
return [
new_block(
ensure_block_shape(x[1].astype(dtype, copy=False), ndim=2),
placement=x[0],
ndim=2,
)
for x in tuples
]
return [
new_block(ensure_block_shape(x[1], ndim=2), placement=x[0], ndim=2)
for x in tuples
Expand Down