pandas.DataFrame.drop_duplicates

Posted zjuhaohaoxuexi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pandas.DataFrame.drop_duplicates相关的知识,希望对你有一定的参考价值。

DataFrame.drop_duplicates(self, subset=None, keep=‘first‘, inplace=False)

Return DataFrame with duplicate rows removed, optionally only considering certain columns. Indexes, including time indexes are ignored.

Parameters:
subset column label or sequence of labels, optional

Only consider certain columns for identifying duplicates, by default use all of the columns

keep {‘first’, ‘last’, False}, default ‘first’
  • first : Drop duplicates except for the first occurrence.
  • last : Drop duplicates except for the last occurrence.
  • False : Drop all duplicates.
inplace boolean, default False

Whether to drop duplicates in place or to return a copy

Returns:
DataFrame

以上是关于pandas.DataFrame.drop_duplicates的主要内容,如果未能解决你的问题,请参考以下文章