File tree 3 files changed +8
-5
lines changed
3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -981,6 +981,7 @@ Performance improvements
981
981
- For :meth:`to_datetime` changed default value of cache parameter to `` True `` (:issue:`26043 ` )
982
982
- Improved performance of :class :`DatetimeIndex` and :class :`PeriodIndex` slicing given non- unique, monotonic data (:issue:`27136 ` ).
983
983
- Improved performance of :meth:`pd.read_json` for index- oriented data. (:issue:`26773 ` )
984
+ - Improved performance of :meth:`MultiIndex.shape` (:issue:`27384 ` ).
984
985
985
986
.. _whatsnew_0250.bug_fixes:
986
987
Original file line number Diff line number Diff line change @@ -5639,6 +5639,13 @@ def _add_logical_methods_disabled(cls):
5639
5639
cls .all = make_invalid_op ("all" )
5640
5640
cls .any = make_invalid_op ("any" )
5641
5641
5642
+ @property
5643
+ def shape (self ):
5644
+ """
5645
+ Return a tuple of the shape of the underlying data.
5646
+ """
5647
+ return (len (self ),)
5648
+
5642
5649
5643
5650
Index ._add_numeric_methods_disabled ()
5644
5651
Index ._add_logical_methods ()
Original file line number Diff line number Diff line change @@ -405,11 +405,6 @@ def size(self):
405
405
# Avoid materializing ndarray[Interval]
406
406
return self ._data .size
407
407
408
- @property
409
- def shape (self ):
410
- # Avoid materializing ndarray[Interval]
411
- return self ._data .shape
412
-
413
408
@property
414
409
def itemsize (self ):
415
410
msg = (
You can’t perform that action at this time.
0 commit comments