Struct polars::prelude::IpcStreamReader
source · pub struct IpcStreamReader<R> { /* private fields */ }
Available on crate feature
polars-io
only.Expand description
Read Arrows Stream IPC format into a DataFrame
§Example
use polars_core::prelude::*;
use std::fs::File;
use polars_io::ipc::IpcStreamReader;
use polars_io::SerReader;
fn example() -> PolarsResult<DataFrame> {
let file = File::open("file.ipc").expect("file not found");
IpcStreamReader::new(file)
.finish()
}
Implementations§
source§impl<R> IpcStreamReader<R>where
R: Read,
impl<R> IpcStreamReader<R>where
R: Read,
sourcepub fn schema(&mut self) -> Result<Schema, PolarsError>
pub fn schema(&mut self) -> Result<Schema, PolarsError>
Get schema of the Ipc Stream File
sourcepub fn arrow_schema(&mut self) -> Result<ArrowSchema, PolarsError>
pub fn arrow_schema(&mut self) -> Result<ArrowSchema, PolarsError>
Get arrow schema of the Ipc Stream File, this is faster than creating a polars schema.
sourcepub fn with_n_rows(self, num_rows: Option<usize>) -> IpcStreamReader<R>
pub fn with_n_rows(self, num_rows: Option<usize>) -> IpcStreamReader<R>
Stop reading when n
rows are read.
sourcepub fn with_columns(self, columns: Option<Vec<String>>) -> IpcStreamReader<R>
pub fn with_columns(self, columns: Option<Vec<String>>) -> IpcStreamReader<R>
Columns to select/ project
sourcepub fn with_row_index(self, row_index: Option<RowIndex>) -> IpcStreamReader<R>
pub fn with_row_index(self, row_index: Option<RowIndex>) -> IpcStreamReader<R>
Add a row index column.
sourcepub fn with_projection(
self,
projection: Option<Vec<usize>>
) -> IpcStreamReader<R>
pub fn with_projection( self, projection: Option<Vec<usize>> ) -> IpcStreamReader<R>
Set the reader’s column projection. This counts from 0, meaning that
vec![0, 4]
would select the 1st and 5th column.
Trait Implementations§
source§impl<R> SerReader<R> for IpcStreamReader<R>where
R: Read,
impl<R> SerReader<R> for IpcStreamReader<R>where
R: Read,
source§fn new(reader: R) -> IpcStreamReader<R>
fn new(reader: R) -> IpcStreamReader<R>
Create a new instance of the
[SerReader]
source§fn set_rechunk(self, rechunk: bool) -> IpcStreamReader<R>
fn set_rechunk(self, rechunk: bool) -> IpcStreamReader<R>
Make sure that all columns are contiguous in memory by
aggregating the chunks into a single array.
Auto Trait Implementations§
impl<R> Freeze for IpcStreamReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for IpcStreamReader<R>where
R: RefUnwindSafe,
impl<R> Send for IpcStreamReader<R>where
R: Send,
impl<R> Sync for IpcStreamReader<R>where
R: Sync,
impl<R> Unpin for IpcStreamReader<R>where
R: Unpin,
impl<R> UnwindSafe for IpcStreamReader<R>where
R: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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> ⓘ
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 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> ⓘ
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