Struct polars::prelude::IpcStreamReader
source · [−]pub struct IpcStreamReader<R> { /* private fields */ }
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() -> Result<DataFrame> {
let file = File::open("file.ipc").expect("file not found");
IpcStreamReader::new(file)
.finish()
}
Implementations
sourceimpl<R> IpcStreamReader<R> where
R: Read + Seek,
impl<R> IpcStreamReader<R> where
R: Read + Seek,
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<Schema, PolarsError>
pub fn arrow_schema(&mut self) -> Result<Schema, 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, Global>>
) -> IpcStreamReader<R>
pub fn with_columns(
self,
columns: Option<Vec<String, Global>>
) -> IpcStreamReader<R>
Columns to select/ project
sourcepub fn with_row_count(self, row_count: Option<RowCount>) -> IpcStreamReader<R>
pub fn with_row_count(self, row_count: Option<RowCount>) -> IpcStreamReader<R>
Add a row_count
column.
sourcepub fn with_projection(
self,
projection: Option<Vec<usize, Global>>
) -> IpcStreamReader<R>
pub fn with_projection(
self,
projection: Option<Vec<usize, Global>>
) -> 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
sourceimpl<R> SerReader<R> for IpcStreamReader<R> where
R: Read + Seek,
impl<R> SerReader<R> for IpcStreamReader<R> where
R: Read + Seek,
fn new(reader: R) -> IpcStreamReader<R>
sourcefn set_rechunk(self, rechunk: bool) -> IpcStreamReader<R>
fn set_rechunk(self, rechunk: bool) -> IpcStreamReader<R>
Rechunk to a single chunk after Reading file.
sourcefn finish(self) -> Result<DataFrame, PolarsError>
fn finish(self) -> Result<DataFrame, PolarsError>
Take the SerReader and return a parsed DataFrame.
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more