Struct polars_io::ipc::IpcStreamReader
source · 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 + Seek> IpcStreamReader<R>
impl<R: Read + Seek> 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_count(self, row_count: Option<RowCount>) -> Self
pub fn with_row_count(self, row_count: Option<RowCount>) -> Self
Add a row_count
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.