We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a8cabb8 commit 5f889a2Copy full SHA for 5f889a2
pandas/tests/test_base.py
@@ -949,6 +949,21 @@ def test_duplicated_drop_duplicates_index(self):
949
s.drop_duplicates(inplace=True)
950
tm.assert_series_equal(s, original)
951
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
+ 'd': [1, 2, 3, 4, 4],
958
+ 'e': [datetime(2015, 1, 1), datetime(2015, 1, 1),
959
+ datetime(2015, 2, 1), pd.NaT, pd.NaT]
960
+ })
961
+ for column in df.columns:
962
+ for keep in ['first', 'last', False]:
963
+ dropped_frame = df[[column]].drop_duplicates(keep=keep)
964
+ dropped_series = df[column].drop_duplicates(keep=keep)
965
+ tm.assert_frame_equal(dropped_frame, dropped_series.to_frame())
966
+
967
def test_fillna(self):
968
# # GH 11343
969
# though Index.fillna and Series.fillna has separate impl,
0 commit comments