Struct polars_core::schema::Schema
source · pub struct Schema { /* private fields */ }Implementations§
source§impl Schema
impl Schema
pub fn try_from_fallible<I>(flds: I) -> PolarsResult<Self>where I: IntoIterator<Item = PolarsResult<Field>>,
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn rename(&mut self, old: &str, new: String) -> Option<()>
pub fn insert_index( &self, index: usize, name: String, dtype: DataType ) -> Option<Self>
pub fn get(&self, name: &str) -> Option<&DataType>
pub fn try_get(&self, name: &str) -> PolarsResult<&DataType>
pub fn try_get_full( &self, name: &str ) -> PolarsResult<(usize, &String, &DataType)>
pub fn remove(&mut self, name: &str) -> Option<DataType>
pub fn get_full(&self, name: &str) -> Option<(usize, &String, &DataType)>
pub fn get_field(&self, name: &str) -> Option<Field>
pub fn try_get_field(&self, name: &str) -> PolarsResult<Field>
pub fn get_index(&self, index: usize) -> Option<(&String, &DataType)>
pub fn contains(&self, name: &str) -> bool
pub fn get_index_mut( &mut self, index: usize ) -> Option<(&mut String, &mut DataType)>
pub fn coerce_by_name(&mut self, name: &str, dtype: DataType) -> Option<()>
pub fn coerce_by_index(&mut self, index: usize, dtype: DataType) -> Option<()>
sourcepub fn with_column(&mut self, name: String, dtype: DataType) -> Option<DataType>
pub fn with_column(&mut self, name: String, dtype: DataType) -> Option<DataType>
Insert a new column in the Schema
If an equivalent name already exists in the schema: the name remains and
retains in its place in the order, its corresponding value is updated
with DataType and the older dtype is returned inside Some(_).
If no equivalent key existed in the map: the new name-dtype pair is
inserted, last in order, and None is returned.
Computes in O(1) time (amortized average).
pub fn merge(&mut self, other: Self)
pub fn to_arrow(&self) -> ArrowSchema
pub fn iter_fields( &self ) -> impl Iterator<Item = Field> + ExactSizeIterator + '_
pub fn iter_dtypes( &self ) -> impl Iterator<Item = &DataType> + ExactSizeIterator + '_
pub fn iter_names( &self ) -> impl Iterator<Item = &String> + '_ + ExactSizeIterator
pub fn iter(&self) -> impl Iterator<Item = (&String, &DataType)> + '_
Trait Implementations§
source§impl<J> FromIterator<J> for Schemawhere
J: Into<Field>,
impl<J> FromIterator<J> for Schemawhere J: Into<Field>,
source§fn from_iter<I: IntoIterator<Item = J>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = J>>(iter: I) -> Self
Creates a value from an iterator. Read more
source§impl IndexOfSchema for Schema
impl IndexOfSchema for Schema
source§impl IntoIterator for Schema
impl IntoIterator for Schema
source§impl PartialEq<Schema> for Schema
impl PartialEq<Schema> for Schema
impl Eq for Schema
impl StructuralEq for Schema
Auto Trait Implementations§
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnwindSafe for Schema
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.