From 22831be75ada88b9b57ad1b9d529feeeb671cd86 Mon Sep 17 00:00:00 2001 From: Marco Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Wed, 19 Feb 2025 10:53:53 +0000 Subject: [PATCH] remove unused dtype from MultiIndex constructor --- doc/source/whatsnew/v3.0.0.rst | 1 + pandas/core/indexes/multi.py | 1 - pandas/tests/indexing/multiindex/test_loc.py | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/whatsnew/v3.0.0.rst b/doc/source/whatsnew/v3.0.0.rst index 4d9a45abe17cd..9d732b0fce450 100644 --- a/doc/source/whatsnew/v3.0.0.rst +++ b/doc/source/whatsnew/v3.0.0.rst @@ -357,6 +357,7 @@ Other API changes - Made ``dtype`` a required argument in :meth:`ExtensionArray._from_sequence_of_strings` (:issue:`56519`) - Passing a :class:`Series` input to :func:`json_normalize` will now retain the :class:`Series` :class:`Index`, previously output had a new :class:`RangeIndex` (:issue:`51452`) - Removed :meth:`Index.sort` which always raised a ``TypeError``. This attribute is not defined and will raise an ``AttributeError`` (:issue:`59283`) +- Unused ``dtype`` argument has been removed from the :class:`MultiIndex` constructor (:issue:`60962`) - Updated :meth:`DataFrame.to_excel` so that the output spreadsheet has no styling. Custom styling can still be done using :meth:`Styler.to_excel` (:issue:`54154`) - pickle and HDF (``.h5``) files created with Python 2 are no longer explicitly supported (:issue:`57387`) - pickled objects from pandas version less than ``1.0.0`` are no longer supported (:issue:`57155`) diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index dc48cd1ed958e..d6b1028d9e78e 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -305,7 +305,6 @@ def __new__( codes=None, sortorder=None, names=None, - dtype=None, copy: bool = False, name=None, verify_integrity: bool = True, diff --git a/pandas/tests/indexing/multiindex/test_loc.py b/pandas/tests/indexing/multiindex/test_loc.py index ec9767aa4bab4..1d3258ab18a61 100644 --- a/pandas/tests/indexing/multiindex/test_loc.py +++ b/pandas/tests/indexing/multiindex/test_loc.py @@ -105,7 +105,7 @@ def test_loc_getitem_series(self): empty = Series(data=[], dtype=np.float64) expected = Series( [], - index=MultiIndex(levels=index.levels, codes=[[], []], dtype=np.float64), + index=MultiIndex(levels=index.levels, codes=[[], []]), dtype=np.float64, ) result = x.loc[empty] @@ -129,7 +129,7 @@ def test_loc_getitem_array(self): empty = np.array([]) expected = Series( [], - index=MultiIndex(levels=index.levels, codes=[[], []], dtype=np.float64), + index=MultiIndex(levels=index.levels, codes=[[], []]), dtype="float64", ) result = x.loc[empty]