Skip to content

REF: avoid using Block attributes #39460

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
Jan 29, 2021
Merged
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
15 changes: 8 additions & 7 deletions pandas/core/internals/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,25 +264,26 @@ def get_reindexed_values(self, empty_dtype: DtypeObj, upcasted_na) -> ArrayLike:
fill_value = upcasted_na

if self.is_na:
if getattr(self.block, "is_object", False):
blk_dtype = getattr(self.block, "dtype", None)

if blk_dtype == np.dtype(object):
# we want to avoid filling with np.nan if we are
# using None; we already know that we are all
# nulls
values = self.block.values.ravel(order="K")
if len(values) and values[0] is None:
fill_value = None

if getattr(self.block, "is_datetimetz", False) or is_datetime64tz_dtype(
if is_datetime64tz_dtype(blk_dtype) or is_datetime64tz_dtype(
empty_dtype
):
if self.block is None:
# TODO(EA2D): special case unneeded with 2D EAs
return DatetimeArray(
np.full(self.shape[1], fill_value.value), dtype=empty_dtype
)
elif getattr(self.block, "is_categorical", False):
i8values = np.full(self.shape[1], fill_value.value)
return DatetimeArray(i8values, dtype=empty_dtype)
elif is_categorical_dtype(blk_dtype):
pass
elif getattr(self.block, "is_extension", False):
elif is_extension_array_dtype(blk_dtype):
pass
elif is_extension_array_dtype(empty_dtype):
missing_arr = empty_dtype.construct_array_type()._from_sequence(
Expand Down