Skip to content
Merged
Changes from all commits
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
23 changes: 23 additions & 0 deletions pandas/tests/frame/methods/test_drop.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
Expand Down Expand Up @@ -268,6 +269,28 @@ def test_drop_non_empty_list(self, index, drop_labels):
with pytest.raises(KeyError, match="not found in axis"):
DataFrame(index=index).drop(drop_labels)

@pytest.mark.parametrize(
"empty_listlike",
[
[],
{},
np.array([]),
Series([], dtype="datetime64[ns]"),
Index([]),
DatetimeIndex([]),
],
)
def test_drop_empty_listlike_non_unique_datetime_index(self, empty_listlike):
# GH#27994
data = {"column_a": [5, 10], "column_b": ["one", "two"]}
index = [Timestamp("2021-01-01"), Timestamp("2021-01-01")]
df = DataFrame(data, index=index)

# Passing empty list-like should return the same DataFrame.
expected = df.copy()
result = df.drop(empty_listlike)
tm.assert_frame_equal(result, expected)

def test_mixed_depth_drop(self):
arrays = [
["a", "top", "top", "routine1", "routine1", "routine2"],
Expand Down