Transform

Struct Transform 

Source
pub struct Transform;
Expand description

Transform operations for DataFrames

Implementations§

Source§

impl Transform

Source

pub fn select(df: &DataFrame, columns: &[String]) -> Result<DataFrame>

Select specific columns from a DataFrame

Source

pub fn select_lazy(lf: LazyFrame, columns: &[String]) -> Result<LazyFrame>

Select specific columns from a LazyFrame

Source

pub fn filter(df: &DataFrame, mask: &Series) -> Result<DataFrame>

Filter DataFrame based on a condition

Source

pub fn filter_lazy(lf: LazyFrame, predicate: Expr) -> Result<LazyFrame>

Filter LazyFrame based on an expression

Source

pub fn sort( df: &DataFrame, by_columns: &[String], descending: Vec<bool>, ) -> Result<DataFrame>

Sort DataFrame by columns

Source

pub fn sort_lazy( lf: LazyFrame, by_columns: &[String], descending: &[bool], ) -> Result<LazyFrame>

Sort LazyFrame by columns

Source

pub fn rename( df: &DataFrame, mapping: &HashMap<String, String>, ) -> Result<DataFrame>

Rename columns in a DataFrame

Source

pub fn rename_lazy( lf: LazyFrame, mapping: &HashMap<String, String>, ) -> Result<LazyFrame>

Rename columns in a LazyFrame

Source

pub fn with_column( df: &DataFrame, name: &str, series: Series, ) -> Result<DataFrame>

Add a new column to a DataFrame

Source

pub fn with_column_lazy(lf: LazyFrame, expr: Expr) -> Result<LazyFrame>

Add a new column expression to a LazyFrame

Source

pub fn drop(df: &DataFrame, columns: &[String]) -> Result<DataFrame>

Drop columns from a DataFrame

Source

pub fn drop_lazy(lf: LazyFrame, columns: &[String]) -> Result<LazyFrame>

Drop columns from a LazyFrame

Source

pub fn unique( df: &DataFrame, subset: Option<&[String]>, keep: UniqueKeepStrategy, ) -> Result<DataFrame>

Get unique values in a DataFrame

Source

pub fn unique_lazy( lf: LazyFrame, subset: Option<&[String]>, keep: UniqueKeepStrategy, ) -> Result<LazyFrame>

Get unique values in a LazyFrame

Source

pub fn limit(df: &DataFrame, n: usize) -> Result<DataFrame>

Limit the number of rows

Source

pub fn limit_lazy(lf: LazyFrame, n: u32) -> Result<LazyFrame>

Limit the number of rows in a LazyFrame

Source

pub fn skip(df: &DataFrame, n: usize) -> Result<DataFrame>

Skip the first n rows

Source

pub fn skip_lazy(lf: LazyFrame, n: u32) -> Result<LazyFrame>

Skip the first n rows in a LazyFrame

Source

pub fn slice(df: &DataFrame, offset: i64, length: usize) -> Result<DataFrame>

Slice a DataFrame

Source

pub fn slice_lazy(lf: LazyFrame, offset: i64, length: u32) -> Result<LazyFrame>

Slice a LazyFrame

Source

pub fn reverse(df: &DataFrame) -> Result<DataFrame>

Reverse the order of rows

Source

pub fn reverse_lazy(lf: LazyFrame) -> Result<LazyFrame>

Reverse the order of rows in a LazyFrame

Source

pub fn sample( df: &DataFrame, n: usize, with_replacement: bool, seed: Option<u64>, ) -> Result<DataFrame>

Sample rows from a DataFrame

Source

pub fn fill_null(df: &DataFrame, value: FillNullStrategy) -> Result<DataFrame>

Fill null values

Source

pub fn fill_null_lazy(lf: LazyFrame, value: Expr) -> Result<LazyFrame>

Fill null values in a LazyFrame

Source

pub fn drop_nulls( df: &DataFrame, subset: Option<&[String]>, ) -> Result<DataFrame>

Drop rows with null values

Source

pub fn drop_nulls_lazy( lf: LazyFrame, _subset: Option<Vec<Expr>>, ) -> Result<LazyFrame>

Drop rows with null values in a LazyFrame

Source

pub fn cast(df: &DataFrame, column: &str, dtype: &DataType) -> Result<DataFrame>

Cast column types

Source

pub fn cast_lazy( lf: LazyFrame, column: &str, dtype: DataType, ) -> Result<LazyFrame>

Cast column types in a LazyFrame

Source

pub fn explode(df: &DataFrame, columns: &[String]) -> Result<DataFrame>

Explode list columns

Source

pub fn explode_lazy(lf: LazyFrame, columns: &[String]) -> Result<LazyFrame>

Explode list columns in a LazyFrame

Source

pub fn melt( df: &DataFrame, id_vars: &[String], value_vars: &[String], _variable_name: Option<&str>, _value_name: Option<&str>, ) -> Result<DataFrame>

Melt DataFrame from wide to long format

Source

pub fn melt_lazy( lf: LazyFrame, id_vars: &[String], value_vars: &[String], _variable_name: Option<&str>, _value_name: Option<&str>, ) -> Result<LazyFrame>

Melt LazyFrame from wide to long format

Source

pub fn pivot( df: &DataFrame, values: &[String], index: &[String], columns: &[String], aggregate_fn: Option<&str>, ) -> Result<DataFrame>

Pivot DataFrame from long to wide format

Source

pub fn map_rows<F, T>(_df: &DataFrame, _f: F) -> Result<DataFrame>
where F: Fn(usize) -> Result<T>, T: Into<Series>,

Apply a function to each row

Source

pub fn map_columns(df: &DataFrame, expr: Expr) -> Result<DataFrame>

Apply a transformation expression to all columns

Source

pub fn transpose( df: &DataFrame, keep_names_as: Option<&str>, ) -> Result<DataFrame>

Transpose a DataFrame

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> PlanCallbackArgs for T

Source§

impl<T> PlanCallbackOut for T