Struct polars_core::schema::Schema

source ·
pub struct Schema { /* private fields */ }

Implementations§

source§

impl Schema

source

pub fn try_from_fallible<I>(flds: I) -> PolarsResult<Self>where I: IntoIterator<Item = PolarsResult<Field>>,

source

pub fn new() -> Self

source

pub fn with_capacity(capacity: usize) -> Self

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

source

pub fn rename(&mut self, old: &str, new: String) -> Option<()>

source

pub fn insert_index( &self, index: usize, name: String, dtype: DataType ) -> Option<Self>

source

pub fn get(&self, name: &str) -> Option<&DataType>

source

pub fn try_get(&self, name: &str) -> PolarsResult<&DataType>

source

pub fn try_get_full( &self, name: &str ) -> PolarsResult<(usize, &String, &DataType)>

source

pub fn remove(&mut self, name: &str) -> Option<DataType>

source

pub fn get_full(&self, name: &str) -> Option<(usize, &String, &DataType)>

source

pub fn get_field(&self, name: &str) -> Option<Field>

source

pub fn try_get_field(&self, name: &str) -> PolarsResult<Field>

source

pub fn get_index(&self, index: usize) -> Option<(&String, &DataType)>

source

pub fn contains(&self, name: &str) -> bool

source

pub fn get_index_mut( &mut self, index: usize ) -> Option<(&mut String, &mut DataType)>

source

pub fn coerce_by_name(&mut self, name: &str, dtype: DataType) -> Option<()>

source

pub fn coerce_by_index(&mut self, index: usize, dtype: DataType) -> Option<()>

source

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).

source

pub fn merge(&mut self, other: Self)

source

pub fn to_arrow(&self) -> ArrowSchema

source

pub fn iter_fields( &self ) -> impl Iterator<Item = Field> + ExactSizeIterator + '_

source

pub fn iter_dtypes( &self ) -> impl Iterator<Item = &DataType> + ExactSizeIterator + '_

source

pub fn iter_names( &self ) -> impl Iterator<Item = &String> + '_ + ExactSizeIterator

source

pub fn iter(&self) -> impl Iterator<Item = (&String, &DataType)> + '_

Trait Implementations§

source§

impl Clone for Schema

source§

fn clone(&self) -> Schema

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Schema

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Schema

source§

fn default() -> Schema

Returns the “default value” for a type. Read more
source§

impl From<&Row<'_>> for Schema

Available on crate feature rows only.
source§

fn from(row: &Row<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&Schema> for DataFrame

source§

fn from(schema: &Schema) -> Self

Converts to this type from the input type.
source§

impl<I, J> From<I> for Schemawhere I: Iterator<Item = J>, J: Into<Field>,

source§

fn from(iter: I) -> Self

Converts to this type from the input type.
source§

impl<J> FromIterator<J> for Schemawhere J: Into<Field>,

source§

fn from_iter<I: IntoIterator<Item = J>>(iter: I) -> Self

Creates a value from an iterator. Read more
source§

impl IndexOfSchema for Schema

source§

fn index_of(&self, name: &str) -> Option<usize>

Available on crate feature private only.
Get the index of column by name.
source§

fn try_index_of(&self, name: &str) -> PolarsResult<usize>

Available on crate feature private only.
source§

impl IntoIterator for Schema

§

type Item = (String, DataType)

The type of the elements being iterated over.
§

type IntoIter = <IndexMap<String, DataType, RandomState> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq<Schema> for Schema

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Schema

source§

impl StructuralEq for Schema

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V