Skip to main content

DataFrame

Struct DataFrame 

Source
pub struct DataFrame { /* private fields */ }
Expand description

Eager DataFrame and GroupBy. An eager table backed by one or more Arrow RecordBatch values.

Implementations§

Source§

impl DataFrame

Source

pub fn new(columns: Vec<Series>) -> Result<Self>

Construct a DataFrame from a list of Series.

Chunk boundaries do not need to align across series as long as total lengths match.

Source

pub fn from_batches(batches: Vec<RecordBatch>) -> Result<Self>

Construct a DataFrame from Arrow record batches (all batches must share the same schema).

Source

pub fn from_series(series: Vec<Series>) -> Result<Self>

Alias for DataFrame::new.

Source

pub fn empty() -> Self

Return an empty DataFrame (no columns, no rows).

Source

pub fn height(&self) -> usize

Return the number of rows.

Source

pub fn width(&self) -> usize

Return the number of columns.

Source

pub fn schema(&self) -> SchemaRef

Return the Arrow schema.

Source

pub fn column(&self, name: &str) -> Result<Series>

Get a column by name (case-sensitive).

Source

pub fn columns(&self) -> Vec<Series>

Return all columns in construction order.

Source

pub fn to_arrow(&self) -> Vec<RecordBatch>

Return the underlying Arrow batches.

Source

pub fn lazy(&self) -> LazyFrame

Convert this eager DataFrame to a LazyFrame for query planning/execution.

Source

pub fn select(&self, exprs: Vec<Expr>) -> Result<Self>

Eager select, implemented by delegating to LazyFrame.

Source

pub fn filter(&self, predicate: Expr) -> Result<Self>

Eager filter, implemented by delegating to LazyFrame.

Source

pub fn with_columns(&self, exprs: Vec<Expr>) -> Result<Self>

Eager with_columns, implemented by delegating to LazyFrame.

Source

pub fn group_by(&self, by: Vec<Expr>) -> GroupBy

Start a group-by aggregation (eager API).

Source

pub fn join<K: Into<JoinKeys>>( &self, other: &DataFrame, keys: K, how: JoinType, ) -> Result<Self>

Join with another DataFrame using provided join keys.

Source

pub fn sort(&self, by: Vec<String>, descending: Vec<bool>) -> Result<Self>

Sort by one or more columns.

Source

pub fn head(&self, n: usize) -> Result<Self>

Return the first n rows.

Source

pub fn tail(&self, n: usize) -> Result<Self>

Return the last n rows.

Source

pub fn unique(&self, subset: Option<Vec<String>>) -> Result<Self>

Remove duplicate rows.

Source

pub fn fill_null<T: Into<FillNull>>(&self, fill: T) -> Result<Self>

Fill null values using a scalar or strategy.

Source

pub fn drop_nulls(&self, subset: Option<Vec<String>>) -> Result<Self>

Drop rows containing null values.

Source

pub fn null_count(&self) -> Result<Self>

Count null values per column.

Trait Implementations§

Source§

impl Clone for DataFrame

Source§

fn clone(&self) -> DataFrame

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DataFrame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.