File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -981,6 +981,7 @@ Performance improvements
981981- For :meth:`to_datetime` changed default value of cache parameter to `` True `` (:issue:`26043 ` )
982982- Improved performance of :class :`DatetimeIndex` and :class :`PeriodIndex` slicing given non- unique, monotonic data (:issue:`27136 ` ).
983983- Improved performance of :meth:`pd.read_json` for index- oriented data. (:issue:`26773 ` )
984+ - Improved performance of :meth:`MultiIndex.shape` (:issue:`27384 ` ).
984985
985986.. _whatsnew_0250.bug_fixes:
986987
Original file line number Diff line number Diff line change @@ -5639,6 +5639,13 @@ def _add_logical_methods_disabled(cls):
56395639 cls .all = make_invalid_op ("all" )
56405640 cls .any = make_invalid_op ("any" )
56415641
5642+ @property
5643+ def shape (self ):
5644+ """
5645+ Return a tuple of the shape of the underlying data.
5646+ """
5647+ return (len (self ),)
5648+
56425649
56435650Index ._add_numeric_methods_disabled ()
56445651Index ._add_logical_methods ()
Original file line number Diff line number Diff line change @@ -405,11 +405,6 @@ def size(self):
405405 # Avoid materializing ndarray[Interval]
406406 return self ._data .size
407407
408- @property
409- def shape (self ):
410- # Avoid materializing ndarray[Interval]
411- return self ._data .shape
412-
413408 @property
414409 def itemsize (self ):
415410 msg = (
You can’t perform that action at this time.
0 commit comments