Skip to content

CLN: remove extraneous arg from get_block_type #43607

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 1 commit into from
Sep 16, 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: 1 addition & 1 deletion pandas/core/internals/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def make_block(

if klass is None:
dtype = dtype or values.dtype
klass = get_block_type(values, dtype)
klass = get_block_type(dtype)

elif klass is DatetimeTZBlock and not is_datetime64tz_dtype(values.dtype):
# pyarrow calls get here
Expand Down
8 changes: 2 additions & 6 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1918,13 +1918,12 @@ def maybe_coerce_values(values: ArrayLike) -> ArrayLike:
return values


def get_block_type(values, dtype: DtypeObj | None = None):
def get_block_type(dtype: DtypeObj):
"""
Find the appropriate Block subclass to use for the given values and dtype.

Parameters
----------
values : ndarray-like
dtype : numpy or pandas dtype

Returns
Expand All @@ -1933,9 +1932,6 @@ def get_block_type(values, dtype: DtypeObj | None = None):
"""
# We use vtype and kind checks because they are much more performant
# than is_foo_dtype
if dtype is None:
dtype = values.dtype

vtype = dtype.type
kind = dtype.kind

Expand Down Expand Up @@ -1970,7 +1966,7 @@ def new_block(values, placement, *, ndim: int, klass=None) -> Block:
check_ndim(values, placement, ndim)

if klass is None:
klass = get_block_type(values, values.dtype)
klass = get_block_type(values.dtype)

values = maybe_coerce_values(values)
return klass(values, ndim=ndim, placement=placement)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,7 @@ def _form_blocks(arrays: list[ArrayLike], consolidate: bool) -> list[Block]:

nbs = []
for (_, _, dtype), tup_block in grouper:
block_type = get_block_type(None, dtype)
block_type = get_block_type(dtype)

if isinstance(dtype, np.dtype):
is_dtlike = dtype.kind in ["m", "M"]
Expand Down