Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.5.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Bug fixes
~~~~~~~~~
- Bug in :meth:`DataFrame.to_hdf` raising ``AssertionError`` with boolean index (:issue:`48667`)
- Bug in :meth:`DataFrame.pivot_table` raising unexpected ``FutureWarning`` when setting datetime column as index (:issue:`48683`)
- Stopped emitting unnecessary ``FutureWarning`` in :meth:`DataFrame.sort_values` with boolean sparse columns (:issue:`48784`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep the pattern:

Bug in ... emitting unnecessary...

otherwise lgtm

-

.. ---------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion pandas/core/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ def lexsort_indexer(
with warnings.catch_warnings():
# TODO(2.0): unnecessary once deprecation is enforced
# GH#45618 don't issue warning user can't do anything about
warnings.filterwarnings("ignore", ".*SparseArray.*", category=FutureWarning)
warnings.filterwarnings(
"ignore", ".*(SparseArray|SparseDtype).*", category=FutureWarning
)

cat = Categorical(k, ordered=True)

Expand Down
5 changes: 3 additions & 2 deletions pandas/tests/frame/methods/test_sort_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@


class TestDataFrameSortValues:
def test_sort_values_sparse_no_warning(self):
@pytest.mark.parametrize("dtype", [np.uint8, bool])
def test_sort_values_sparse_no_warning(self, dtype):
# GH#45618
# TODO(2.0): test will be unnecessary
ser = pd.Series(Categorical(["a", "b", "a"], categories=["a", "b", "c"]))
df = pd.get_dummies(ser, sparse=True)
df = pd.get_dummies(ser, dtype=dtype, sparse=True)

with tm.assert_produces_warning(None):
# No warnings about constructing Index from SparseArray
Expand Down