Skip to content

Commit 4bb9809

Browse files
committed
STY: isort
1 parent a3a4c7e commit 4bb9809

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

pandas/_libs/reduction.pyx

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ from cpython.ref cimport Py_INCREF
55

66
from libc.stdlib cimport malloc, free
77

8-
from pandas.core.dtypes.generic import ABCMultiIndex
9-
108
import numpy as np
119
cimport numpy as cnp
1210
from numpy cimport (ndarray,
@@ -494,7 +492,8 @@ def apply_frame_axis0(object frame, object f, object names,
494492
object piece
495493
dict item_cache
496494

497-
if isinstance(frame.index, ABCMultiIndex):
495+
if frame.index.nlevels > 1:
496+
# MultiIndex
498497
raise InvalidApply('Cannot modify frame index internals')
499498

500499
results = []
@@ -626,7 +625,7 @@ def compute_reduction(arr, f, axis=0, dummy=None, labels=None):
626625

627626
if labels is not None:
628627
# Caller is responsible for ensuring we don't have MultiIndex
629-
assert not isinstance(frame.index, ABCMultiIndex),('MultiIndex type')
628+
assert frame.index.nlevels == 1
630629

631630
# pass as an ndarray/ExtensionArray
632631
labels = labels._values

pandas/core/apply.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
from pandas._libs import reduction as libreduction
66
from pandas.util._decorators import cache_readonly
77

8-
from pandas.core.dtypes.generic import ABCMultiIndex
9-
108
from pandas.core.dtypes.common import (
119
is_dict_like,
1210
is_extension_array_dtype,
1311
is_list_like,
1412
is_sequence,
1513
)
16-
from pandas.core.dtypes.generic import ABCSeries
14+
from pandas.core.dtypes.generic import ABCMultiIndex, ABCSeries
1715

1816

1917
def frame_apply(

0 commit comments

Comments
 (0)