Skip to content

Commit 8feda0e

Browse files
committed
whatsnew
1 parent de69486 commit 8feda0e

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ Performance improvements
432432
- Performance improvement in :meth:`RangeIndex.reindex` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57647`, :issue:`57752`)
433433
- Performance improvement in :meth:`RangeIndex.take` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57445`, :issue:`57752`)
434434
- Performance improvement in :func:`merge` if hash-join can be used (:issue:`57970`)
435+
- Performance improvement in :meth:`DataFrame.stack` when using ``future_stack=True`` and the DataFrame does not have a :class:`MultiIndex` (:issue:`58391`)
435436
- Performance improvement in :meth:`to_hdf` avoid unnecessary reopenings of the HDF5 file to speedup data addition to files with a very large number of groups . (:issue:`58248`)
436437
- Performance improvement in ``DataFrameGroupBy.__len__`` and ``SeriesGroupBy.__len__`` (:issue:`57595`)
437438
- Performance improvement in indexing operations for string dtypes (:issue:`56997`)

pandas/core/reshape/reshape.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ def stack_v3(frame: DataFrame, level: list[int]) -> Series | DataFrame:
938938

939939
result: Series | DataFrame
940940
if not isinstance(frame.columns, MultiIndex):
941-
# Fast path when we're stacking the columns of a non-MultiIndex.
941+
# GH#58817 Fast path when we're stacking the columns of a non-MultiIndex.
942942
# When columns are homogeneous EAs, we pass through object
943943
# dtype but this is still slightly faster than the normal path.
944944
if len(frame.columns) > 0 and frame._is_homogeneous_type:

pandas/tests/extension/base/reshaping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def test_stack(self, data, columns, future_stack):
269269

270270
if isinstance(expected, pd.Series):
271271
if future_stack and isinstance(data.dtype, NumpyEADtype):
272-
# future_stack=True constructs the result specifying the dtype
272+
# GH#58817 future_stack=True constructs the result specifying the dtype
273273
# using the dtype of the input; we thus get the underlying
274274
# NumPy dtype as the result instead of the NumpyExtensionArray
275275
assert result.dtype == df.iloc[:, 0].to_numpy().dtype

0 commit comments

Comments
 (0)