pub fn drop_duplicates(&self, maintain_order: bool, subset: Option<&[String]>) -> Result<Self> {
        let names = match &subset {
            Some(s) => s.iter().map(|s| &**s).collect(),
            None => self.get_column_names(),
        };
        let gb = self.groupby(names)?;
        let groups = gb.get_groups().iter().map(|v| v.0);

        let df = if maintain_order {
            let mut groups = groups.collect::<Vec<_>>();
            groups.sort_unstable();
            let cap = Some(groups.len());
            unsafe { self.take_iter_unchecked(groups.into_iter(), cap) }
        } else {
            let cap = Some(groups.size_hint().0);
            unsafe { self.take_iter_unchecked(groups, cap) }
        };

        Ok(df)
    }
/// Drop duplicate rows from a DataFrame.
/// *This fails when there is a column of type List in DataFrame*
///
/// # Example
///
/// ```rust
///
/// # #[macro_use] extern crate polars;
/// # fn main() {
///  use polars::prelude::*;
///
///  fn example() -> Result<DataFrame> {
///      let df = df! {
///                    "flt" => [1., 1., 2., 2., 3., 3.],
///                    "int" => [1, 1, 2, 2, 3, 3, ],
///                    "str" => ["a", "a", "b", "b", "c", "c"]
///                }?;
///      df.drop_duplicates(true, None)
///  }
/// # }
/// ```
/// Returns
///
/// ```text
/// +-----+-----+-----+
/// | flt | int | str |
/// | --- | --- | --- |
/// | f64 | i32 | str |
/// +=====+=====+=====+
/// | 1   | 1   | "a" |
/// +-----+-----+-----+
/// | 2   | 2   | "b" |
/// +-----+-----+-----+
/// | 3   | 3   | "c" |
/// +-----+-----+-----+
/// ```
Drop duplicate rows from a DataFrame.
This fails when there is a column of type List in DataFrame
Drop duplicate rows from a DataFrame . This fails when there is a column of type List in DataFrame
pub fn drop_duplicates(&self, maintain_order: bool, subset: Option<&[String]>) -> Result<Self> {
        let names = match &subset {
            Some(s) => s.iter().map(|s| &**s).collect(),
            None => self.get_column_names(),
        };
        let gb = self.groupby(names)?;
        let groups = gb.get_groups().iter().map(|v| v.0);
        let df = if maintain_order {
            let mut groups = groups.collect::<Vec<_>>();
            groups.sort_unstable();
            let cap = Some(groups.len());
            unsafe { self.take_iter_unchecked(groups.into_iter(), cap) }
        } else {
            let cap = Some(groups.size_hint().0);
            unsafe { self.take_iter_unchecked(groups, cap) }
        };
        Ok(df)
    }
pub fn drop_duplicates ( & self , maintain_order : bool , subset : Option < & [ String ] > ) -> Result < Self > { let names = match & subset { Some ( s ) => s . iter ( ) . map ( | s | & * * s ) . collect ( ) , None => self . get_column_names ( ) , } ; let gb = self . groupby ( names ) ? ; let groups = gb . get_groups ( ) . iter ( ) . map ( | v | v . 0 ) ; let df = if maintain_order { let mut groups = groups . collect :: < Vec < _ > > ( ) ; groups . sort_unstable ( ) ; let cap = Some ( groups . len ( ) ) ; unsafe { self . take_iter_unchecked ( groups . into_iter ( ) , cap ) } } else { let cap = Some ( groups . size_hint ( ) . 0 ) ; unsafe { self . take_iter_unchecked ( groups , cap ) } } ; Ok ( df ) }
Drop duplicate rows from a DataFrame.
Drop duplicate rows from a DataFrame .
&self
maintain_order
bool
subset
Option<&[String]>
&self
maintain_order
bool
subset
Option<&[String]>
example
None
#[macro_use] extern crate polars;
None
fn main() {
use polars::prelude::*.

fn example() -> Result {
let df = df.
use polars :: prelude :: * . fn example () - > Result { let df = df .
}
None