pub struct Transform;Expand description
Transform operations for DataFrames
Implementations§
Source§impl Transform
impl Transform
Sourcepub fn select(df: &DataFrame, columns: &[String]) -> Result<DataFrame>
pub fn select(df: &DataFrame, columns: &[String]) -> Result<DataFrame>
Select specific columns from a DataFrame
Sourcepub fn select_lazy(lf: LazyFrame, columns: &[String]) -> Result<LazyFrame>
pub fn select_lazy(lf: LazyFrame, columns: &[String]) -> Result<LazyFrame>
Select specific columns from a LazyFrame
Sourcepub fn filter(df: &DataFrame, mask: &Series) -> Result<DataFrame>
pub fn filter(df: &DataFrame, mask: &Series) -> Result<DataFrame>
Filter DataFrame based on a condition
Sourcepub fn filter_lazy(lf: LazyFrame, predicate: Expr) -> Result<LazyFrame>
pub fn filter_lazy(lf: LazyFrame, predicate: Expr) -> Result<LazyFrame>
Filter LazyFrame based on an expression
Sourcepub fn sort(
df: &DataFrame,
by_columns: &[String],
descending: Vec<bool>,
) -> Result<DataFrame>
pub fn sort( df: &DataFrame, by_columns: &[String], descending: Vec<bool>, ) -> Result<DataFrame>
Sort DataFrame by columns
Sourcepub fn sort_lazy(
lf: LazyFrame,
by_columns: &[String],
descending: &[bool],
) -> Result<LazyFrame>
pub fn sort_lazy( lf: LazyFrame, by_columns: &[String], descending: &[bool], ) -> Result<LazyFrame>
Sort LazyFrame by columns
Sourcepub fn rename(
df: &DataFrame,
mapping: &HashMap<String, String>,
) -> Result<DataFrame>
pub fn rename( df: &DataFrame, mapping: &HashMap<String, String>, ) -> Result<DataFrame>
Rename columns in a DataFrame
Sourcepub fn rename_lazy(
lf: LazyFrame,
mapping: &HashMap<String, String>,
) -> Result<LazyFrame>
pub fn rename_lazy( lf: LazyFrame, mapping: &HashMap<String, String>, ) -> Result<LazyFrame>
Rename columns in a LazyFrame
Sourcepub fn with_column(
df: &DataFrame,
name: &str,
series: Series,
) -> Result<DataFrame>
pub fn with_column( df: &DataFrame, name: &str, series: Series, ) -> Result<DataFrame>
Add a new column to a DataFrame
Sourcepub fn with_column_lazy(lf: LazyFrame, expr: Expr) -> Result<LazyFrame>
pub fn with_column_lazy(lf: LazyFrame, expr: Expr) -> Result<LazyFrame>
Add a new column expression to a LazyFrame
Sourcepub fn drop(df: &DataFrame, columns: &[String]) -> Result<DataFrame>
pub fn drop(df: &DataFrame, columns: &[String]) -> Result<DataFrame>
Drop columns from a DataFrame
Sourcepub fn drop_lazy(lf: LazyFrame, columns: &[String]) -> Result<LazyFrame>
pub fn drop_lazy(lf: LazyFrame, columns: &[String]) -> Result<LazyFrame>
Drop columns from a LazyFrame
Sourcepub fn unique(
df: &DataFrame,
subset: Option<&[String]>,
keep: UniqueKeepStrategy,
) -> Result<DataFrame>
pub fn unique( df: &DataFrame, subset: Option<&[String]>, keep: UniqueKeepStrategy, ) -> Result<DataFrame>
Get unique values in a DataFrame
Sourcepub fn unique_lazy(
lf: LazyFrame,
subset: Option<&[String]>,
keep: UniqueKeepStrategy,
) -> Result<LazyFrame>
pub fn unique_lazy( lf: LazyFrame, subset: Option<&[String]>, keep: UniqueKeepStrategy, ) -> Result<LazyFrame>
Get unique values in a LazyFrame
Sourcepub fn limit_lazy(lf: LazyFrame, n: u32) -> Result<LazyFrame>
pub fn limit_lazy(lf: LazyFrame, n: u32) -> Result<LazyFrame>
Limit the number of rows in a LazyFrame
Sourcepub fn skip_lazy(lf: LazyFrame, n: u32) -> Result<LazyFrame>
pub fn skip_lazy(lf: LazyFrame, n: u32) -> Result<LazyFrame>
Skip the first n rows in a LazyFrame
Sourcepub fn slice(df: &DataFrame, offset: i64, length: usize) -> Result<DataFrame>
pub fn slice(df: &DataFrame, offset: i64, length: usize) -> Result<DataFrame>
Slice a DataFrame
Sourcepub fn slice_lazy(lf: LazyFrame, offset: i64, length: u32) -> Result<LazyFrame>
pub fn slice_lazy(lf: LazyFrame, offset: i64, length: u32) -> Result<LazyFrame>
Slice a LazyFrame
Sourcepub fn reverse_lazy(lf: LazyFrame) -> Result<LazyFrame>
pub fn reverse_lazy(lf: LazyFrame) -> Result<LazyFrame>
Reverse the order of rows in a LazyFrame
Sourcepub fn sample(
df: &DataFrame,
n: usize,
with_replacement: bool,
seed: Option<u64>,
) -> Result<DataFrame>
pub fn sample( df: &DataFrame, n: usize, with_replacement: bool, seed: Option<u64>, ) -> Result<DataFrame>
Sample rows from a DataFrame
Sourcepub fn fill_null(df: &DataFrame, value: FillNullStrategy) -> Result<DataFrame>
pub fn fill_null(df: &DataFrame, value: FillNullStrategy) -> Result<DataFrame>
Fill null values
Sourcepub fn fill_null_lazy(lf: LazyFrame, value: Expr) -> Result<LazyFrame>
pub fn fill_null_lazy(lf: LazyFrame, value: Expr) -> Result<LazyFrame>
Fill null values in a LazyFrame
Sourcepub fn drop_nulls(
df: &DataFrame,
subset: Option<&[String]>,
) -> Result<DataFrame>
pub fn drop_nulls( df: &DataFrame, subset: Option<&[String]>, ) -> Result<DataFrame>
Drop rows with null values
Sourcepub fn drop_nulls_lazy(
lf: LazyFrame,
_subset: Option<Vec<Expr>>,
) -> Result<LazyFrame>
pub fn drop_nulls_lazy( lf: LazyFrame, _subset: Option<Vec<Expr>>, ) -> Result<LazyFrame>
Drop rows with null values in a LazyFrame
Sourcepub fn cast(df: &DataFrame, column: &str, dtype: &DataType) -> Result<DataFrame>
pub fn cast(df: &DataFrame, column: &str, dtype: &DataType) -> Result<DataFrame>
Cast column types
Sourcepub fn cast_lazy(
lf: LazyFrame,
column: &str,
dtype: DataType,
) -> Result<LazyFrame>
pub fn cast_lazy( lf: LazyFrame, column: &str, dtype: DataType, ) -> Result<LazyFrame>
Cast column types in a LazyFrame
Sourcepub fn explode_lazy(lf: LazyFrame, columns: &[String]) -> Result<LazyFrame>
pub fn explode_lazy(lf: LazyFrame, columns: &[String]) -> Result<LazyFrame>
Explode list columns in a LazyFrame
Sourcepub fn melt(
df: &DataFrame,
id_vars: &[String],
value_vars: &[String],
_variable_name: Option<&str>,
_value_name: Option<&str>,
) -> Result<DataFrame>
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
Sourcepub fn melt_lazy(
lf: LazyFrame,
id_vars: &[String],
value_vars: &[String],
_variable_name: Option<&str>,
_value_name: Option<&str>,
) -> Result<LazyFrame>
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
Sourcepub fn pivot(
df: &DataFrame,
values: &[String],
index: &[String],
columns: &[String],
aggregate_fn: Option<&str>,
) -> Result<DataFrame>
pub fn pivot( df: &DataFrame, values: &[String], index: &[String], columns: &[String], aggregate_fn: Option<&str>, ) -> Result<DataFrame>
Pivot DataFrame from long to wide format
Sourcepub fn map_rows<F, T>(_df: &DataFrame, _f: F) -> Result<DataFrame>
pub fn map_rows<F, T>(_df: &DataFrame, _f: F) -> Result<DataFrame>
Apply a function to each row
Auto Trait Implementations§
impl Freeze for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnwindSafe for Transform
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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