Skip to content
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

BUG/TST: fix a bunch of arraymanager+pyarrow tests #48428

Merged
merged 3 commits into from
Sep 12, 2022
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
17 changes: 4 additions & 13 deletions pandas/core/internals/array_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,19 +297,10 @@ def apply_with_block(self: T, f, align_keys=None, swap_axis=True, **kwargs) -> T
if obj.ndim == 2:
kwargs[k] = obj[[i]]

# error: Item "ExtensionArray" of "Union[Any, ExtensionArray]" has no
# attribute "tz"
if hasattr(arr, "tz") and arr.tz is None: # type: ignore[union-attr]
# DatetimeArray needs to be converted to ndarray for DatetimeLikeBlock

# error: Item "ExtensionArray" of "Union[Any, ExtensionArray]" has no
# attribute "_data"
arr = arr._data # type: ignore[union-attr]
elif arr.dtype.kind == "m" and not isinstance(arr, np.ndarray):
# TimedeltaArray needs to be converted to ndarray for TimedeltaBlock

# error: "ExtensionArray" has no attribute "_data"
arr = arr._data # type: ignore[attr-defined]
if isinstance(arr.dtype, np.dtype) and not isinstance(arr, np.ndarray):
# i.e. TimedeltaArray, DatetimeArray with tz=None. Need to
# convert for the Block constructors.
arr = np.asarray(arr)

if self.ndim == 2:
arr = ensure_block_shape(arr, 2)
Expand Down
Loading