Skip to main content

DataFrame

Struct DataFrame 

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

An eager table backed by one or more Arrow RecordBatch values.

Implementations§

Source§

impl DataFrame

Source

pub fn new(columns: Vec<Series>) -> Result<DataFrame, DataFrameError>

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<DataFrame, DataFrameError>

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

Source

pub fn from_series(series: Vec<Series>) -> Result<DataFrame, DataFrameError>

Alias for DataFrame::new.

Source

pub fn empty() -> DataFrame

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) -> Arc<Schema>

Return the Arrow schema.

Source

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

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<DataFrame, DataFrameError>

Eager select, implemented by delegating to LazyFrame.

Source

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

Eager filter, implemented by delegating to LazyFrame.

Source

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

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>( &self, other: &DataFrame, keys: K, how: JoinType, ) -> Result<DataFrame, DataFrameError>
where K: Into<JoinKeys>,

Join with another DataFrame using provided join keys.

Source

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

Sort by one or more columns.

Source

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

Return the first n rows.

Source

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

Return the last n rows.

Source

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

Remove duplicate rows.

Source

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

Fill null values using a scalar or strategy.

Source

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

Drop rows containing null values.

Source

pub fn null_count(&self) -> Result<DataFrame, DataFrameError>

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<(), Error>

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> 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
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.
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> MaybeSend for T
where T: Send,