pub struct IpcStreamReader<R> { /* private fields */ }
Available on crate feature
ipc_streaming
and (crate features ipc
or ipc_streaming
) 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: Read> IpcStreamReader<R>
impl<R: Read> IpcStreamReader<R>
Sourcepub fn schema(&mut self) -> PolarsResult<Schema>
pub fn schema(&mut self) -> PolarsResult<Schema>
Get schema of the Ipc Stream File
Sourcepub fn arrow_schema(&mut self) -> PolarsResult<ArrowSchema>
pub fn arrow_schema(&mut self) -> PolarsResult<ArrowSchema>
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>) -> Self
pub fn with_n_rows(self, num_rows: Option<usize>) -> Self
Stop reading when n
rows are read.
Sourcepub fn with_columns(self, columns: Option<Vec<String>>) -> Self
pub fn with_columns(self, columns: Option<Vec<String>>) -> Self
Columns to select/ project
Sourcepub fn with_row_index(self, row_index: Option<RowIndex>) -> Self
pub fn with_row_index(self, row_index: Option<RowIndex>) -> Self
Add a row index column.
Sourcepub fn with_projection(self, projection: Option<Vec<usize>>) -> Self
pub fn with_projection(self, projection: Option<Vec<usize>>) -> Self
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 set_rechunk(self, rechunk: bool) -> Self
fn set_rechunk(self, rechunk: bool) -> Self
Make sure that all columns are contiguous in memory by
aggregating the chunks into a single array.
Source§fn finish(self) -> PolarsResult<DataFrame>
fn finish(self) -> PolarsResult<DataFrame>
Take the SerReader and return a parsed DataFrame.
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> 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>
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