Skip to content

Commit

Permalink
BUG/TST: fix a bunch of arraymanager+pyarrow tests (pandas-dev#48428)
Browse files Browse the repository at this point in the history
* BUG/TST: fix a bunch of arraymanager+pyarrow tests

* remove unnecessary using_array_manager
  • Loading branch information
jbrockmendel authored and noatamir committed Nov 9, 2022
1 parent 9d9ed9c commit 4a7b332
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 335 deletions.
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

0 comments on commit 4a7b332

Please sign in to comment.