Skip to content

Commit ddcec67

Browse files
authored
remove unused dtype from MultiIndex constructor (#60963)
* remove unused dtype from MultiIndex constructor * remove from docstring
1 parent 1d8bbb7 commit ddcec67

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

doc/source/whatsnew/v3.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ Other API changes
358358
- Made ``dtype`` a required argument in :meth:`ExtensionArray._from_sequence_of_strings` (:issue:`56519`)
359359
- 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`)
360360
- Removed :meth:`Index.sort` which always raised a ``TypeError``. This attribute is not defined and will raise an ``AttributeError`` (:issue:`59283`)
361+
- Unused ``dtype`` argument has been removed from the :class:`MultiIndex` constructor (:issue:`60962`)
361362
- 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`)
362363
- pickle and HDF (``.h5``) files created with Python 2 are no longer explicitly supported (:issue:`57387`)
363364
- pickled objects from pandas version less than ``1.0.0`` are no longer supported (:issue:`57155`)

pandas/core/indexes/multi.py

-3
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ class MultiIndex(Index):
212212
level).
213213
names : optional sequence of objects
214214
Names for each of the index levels. (name is accepted for compat).
215-
dtype : Numpy dtype or pandas type, optional
216-
Data type for the MultiIndex.
217215
copy : bool, default False
218216
Copy the meta-data.
219217
name : Label
@@ -305,7 +303,6 @@ def __new__(
305303
codes=None,
306304
sortorder=None,
307305
names=None,
308-
dtype=None,
309306
copy: bool = False,
310307
name=None,
311308
verify_integrity: bool = True,

pandas/tests/indexing/multiindex/test_loc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_loc_getitem_series(self):
105105
empty = Series(data=[], dtype=np.float64)
106106
expected = Series(
107107
[],
108-
index=MultiIndex(levels=index.levels, codes=[[], []], dtype=np.float64),
108+
index=MultiIndex(levels=index.levels, codes=[[], []]),
109109
dtype=np.float64,
110110
)
111111
result = x.loc[empty]
@@ -129,7 +129,7 @@ def test_loc_getitem_array(self):
129129
empty = np.array([])
130130
expected = Series(
131131
[],
132-
index=MultiIndex(levels=index.levels, codes=[[], []], dtype=np.float64),
132+
index=MultiIndex(levels=index.levels, codes=[[], []]),
133133
dtype="float64",
134134
)
135135
result = x.loc[empty]

0 commit comments

Comments
 (0)