Skip to content

Commit

Permalink
remove unused dtype from MultiIndex constructor (#60963)
Browse files Browse the repository at this point in the history
* remove unused dtype from MultiIndex constructor

* remove from docstring
  • Loading branch information
MarcoGorelli authored Feb 20, 2025
1 parent 1d8bbb7 commit ddcec67
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v3.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,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`)
Expand Down
3 changes: 0 additions & 3 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ class MultiIndex(Index):
level).
names : optional sequence of objects
Names for each of the index levels. (name is accepted for compat).
dtype : Numpy dtype or pandas type, optional
Data type for the MultiIndex.
copy : bool, default False
Copy the meta-data.
name : Label
Expand Down Expand Up @@ -305,7 +303,6 @@ def __new__(
codes=None,
sortorder=None,
names=None,
dtype=None,
copy: bool = False,
name=None,
verify_integrity: bool = True,
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/indexing/multiindex/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down

0 comments on commit ddcec67

Please sign in to comment.