Skip to content

Commit 0809008

Browse files
committed
TST:Same return values in drop_duplicates for Series and DataFrames(#14192)
1 parent 1b0333b commit 0809008

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/test_base.py

+11
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,17 @@ def test_duplicated_drop_duplicates_index(self):
949949
s.drop_duplicates(inplace=True)
950950
tm.assert_series_equal(s, original)
951951

952+
def test_drop_duplicates_series_vs_dataframe(self):
953+
# GH 14192
954+
df = pd.DataFrame({'a': [1, 1, 1, 'one', 'one'],
955+
'b': [2, 2, np.nan, np.nan, np.nan],
956+
'c': [3, 3, np.nan, np.nan, 'three']
957+
})
958+
for column in df.columns:
959+
dropped_frame = df[[column]].drop_duplicates()
960+
dropped_series = df[column].drop_duplicates()
961+
tm.assert_frame_equal(dropped_frame, dropped_series.to_frame())
962+
952963
def test_fillna(self):
953964
# # GH 11343
954965
# though Index.fillna and Series.fillna has separate impl,

0 commit comments

Comments
 (0)