pub struct IpcReader<R>where
R: MmapBytesReader,{ /* private fields */ }
Available on crate feature
polars-io
only.Expand description
Read Arrows IPC format into a DataFrame
§Example
use polars_core::prelude::*;
use std::fs::File;
use polars_io::ipc::IpcReader;
use polars_io::SerReader;
fn example() -> PolarsResult<DataFrame> {
let file = File::open("file.ipc").expect("file not found");
IpcReader::new(file)
.finish()
}
Implementations§
source§impl<R> IpcReader<R>where
R: MmapBytesReader,
impl<R> IpcReader<R>where
R: MmapBytesReader,
sourcepub fn schema(&mut self) -> Result<Arc<ArrowSchema>, PolarsError>
pub fn schema(&mut self) -> Result<Arc<ArrowSchema>, PolarsError>
Get arrow schema of the Ipc File.
sourcepub fn with_n_rows(self, num_rows: Option<usize>) -> IpcReader<R>
pub fn with_n_rows(self, num_rows: Option<usize>) -> IpcReader<R>
Stop reading when n
rows are read.
sourcepub fn with_columns(self, columns: Option<Vec<String>>) -> IpcReader<R>
pub fn with_columns(self, columns: Option<Vec<String>>) -> IpcReader<R>
Columns to select/ project
sourcepub fn with_row_index(self, row_index: Option<RowIndex>) -> IpcReader<R>
pub fn with_row_index(self, row_index: Option<RowIndex>) -> IpcReader<R>
Add a row index column.
sourcepub fn with_projection(self, projection: Option<Vec<usize>>) -> IpcReader<R>
pub fn with_projection(self, projection: Option<Vec<usize>>) -> IpcReader<R>
Set the reader’s column projection. This counts from 0, meaning that
vec![0, 4]
would select the 1st and 5th column.
sourcepub fn memory_mapped(self, path_buf: Option<PathBuf>) -> IpcReader<R>
pub fn memory_mapped(self, path_buf: Option<PathBuf>) -> IpcReader<R>
Set if the file is to be memory_mapped. Only works with uncompressed files. The file name must be passed to register the memory mapped file.
pub fn finish_with_scan_ops( self, predicate: Option<Arc<dyn PhysicalIoExpr>>, verbose: bool ) -> Result<DataFrame, PolarsError>
Available on crate feature
lazy
only.Trait Implementations§
source§impl<R> SerReader<R> for IpcReader<R>where
R: MmapBytesReader,
impl<R> SerReader<R> for IpcReader<R>where
R: MmapBytesReader,
source§fn set_rechunk(self, rechunk: bool) -> IpcReader<R>
fn set_rechunk(self, rechunk: bool) -> IpcReader<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 IpcReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for IpcReader<R>where
R: RefUnwindSafe,
impl<R> Send for IpcReader<R>
impl<R> Sync for IpcReader<R>
impl<R> Unpin for IpcReader<R>where
R: Unpin,
impl<R> UnwindSafe for IpcReader<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