Type Alias polars_core::datatypes::StringChunked

source ·
pub type StringChunked = ChunkedArray<StringType>;

Aliased Type§

struct StringChunked { /* private fields */ }

Implementations§

source§

impl StringChunked

source

pub fn apply_mut<'a, F>(&'a self, f: F) -> Self
where F: FnMut(&'a str) -> &'a str,

source

pub fn apply_to_buffer<'a, F>(&'a self, f: F) -> Self
where F: FnMut(&'a str, &mut String),

Utility that reuses an string buffer to amortize allocations. Prefer this over an apply that returns an owned String.

source§

impl StringChunked

source

pub fn to_decimal(&self, infer_length: usize) -> PolarsResult<Series>

Available on crate feature dtype-decimal only.

Convert an StringChunked to a Series of DataType::Decimal. Scale needed for the decimal type are inferred. Parsing is not strict.
Scale inference assumes that all tested strings are well-formed numbers, and may produce unexpected results for scale if this is not the case.

If the decimal precision and scale are already known, consider using the cast method.

source§

impl StringChunked

source§

impl StringChunked

source

pub fn par_iter_indexed( &self ) -> impl IndexedParallelIterator<Item = Option<&str>>

source

pub fn par_iter(&self) -> impl ParallelIterator<Item = Option<&str>> + '_

Trait Implementations§

source§

impl Add<&str> for &StringChunked

§

type Output = ChunkedArray<StringType>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &str) -> Self::Output

Performs the + operation. Read more
source§

impl Add for &StringChunked

§

type Output = ChunkedArray<StringType>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl Add for StringChunked

§

type Output = ChunkedArray<StringType>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl AggList for StringChunked

Available on crate feature algorithm_group_by only.
source§

unsafe fn agg_list(&self, groups: &GroupsProxy) -> Series

Safety Read more
source§

impl ChunkAggSeries for StringChunked

source§

fn sum_as_series(&self) -> Series

Get the sum of the ChunkedArray as a new Series of length 1.
source§

fn max_as_series(&self) -> Series

Get the max of the ChunkedArray as a new Series of length 1.
source§

fn min_as_series(&self) -> Series

Get the min of the ChunkedArray as a new Series of length 1.
source§

fn prod_as_series(&self) -> Series

Get the product of the ChunkedArray as a new Series of length 1.
source§

impl ChunkAnyValue for StringChunked

source§

unsafe fn get_any_value_unchecked(&self, index: usize) -> AnyValue<'_>

Get a single value. Beware this is slow. If you need to use this slightly performant, cast Categorical to UInt32 Read more
source§

fn get_any_value(&self, index: usize) -> PolarsResult<AnyValue<'_>>

Get a single value. Beware this is slow.
source§

impl<'a> ChunkApply<'a, &'a str> for StringChunked

§

type FuncRet = Cow<'a, str>

source§

fn apply_values<F>(&'a self, f: F) -> Self
where F: Fn(&'a str) -> Cow<'a, str> + Copy,

Apply a closure elementwise. This is fastest when the null check branching is more expensive than the closure application. Often it is. Read more
source§

fn apply<F>(&'a self, f: F) -> Self
where F: Fn(Option<&'a str>) -> Option<Cow<'a, str>> + Copy,

Apply a closure elementwise including null values.
source§

fn apply_to_slice<F, T>(&'a self, f: F, slice: &mut [T])
where F: Fn(Option<&'a str>, &T) -> T,

Apply a closure elementwise and write results to a mutable slice.
source§

impl ChunkApplyKernel<BinaryViewArrayGeneric<str>> for StringChunked

source§

fn apply_kernel(&self, f: &dyn Fn(&Utf8ViewArray) -> ArrayRef) -> Self

Apply kernel and return result as a new ChunkedArray.
source§

fn apply_kernel_cast<S>( &self, f: &dyn Fn(&Utf8ViewArray) -> ArrayRef ) -> ChunkedArray<S>
where S: PolarsDataType,

Apply a kernel that outputs an array of different type.
source§

impl ChunkCast for StringChunked

source§

fn cast(&self, data_type: &DataType) -> PolarsResult<Series>

source§

unsafe fn cast_unchecked(&self, data_type: &DataType) -> PolarsResult<Series>

Does not check if the cast is a valid one and may over/underflow Read more
source§

impl ChunkCompare<&ChunkedArray<StringType>> for StringChunked

§

type Item = ChunkedArray<BooleanType>

source§

fn equal(&self, rhs: &StringChunked) -> BooleanChunked

Check for equality.
source§

fn equal_missing(&self, rhs: &StringChunked) -> BooleanChunked

Check for equality where None == None.
source§

fn not_equal(&self, rhs: &StringChunked) -> BooleanChunked

Check for inequality.
source§

fn not_equal_missing(&self, rhs: &StringChunked) -> BooleanChunked

Check for inequality where None == None.
source§

fn gt(&self, rhs: &StringChunked) -> BooleanChunked

Greater than comparison.
source§

fn gt_eq(&self, rhs: &StringChunked) -> BooleanChunked

Greater than or equal comparison.
source§

fn lt(&self, rhs: &StringChunked) -> BooleanChunked

Less than comparison.
source§

fn lt_eq(&self, rhs: &StringChunked) -> BooleanChunked

Less than or equal comparison
source§

impl ChunkCompare<&str> for StringChunked

§

type Item = ChunkedArray<BooleanType>

source§

fn equal(&self, rhs: &str) -> BooleanChunked

Check for equality.
source§

fn equal_missing(&self, rhs: &str) -> BooleanChunked

Check for equality where None == None.
source§

fn not_equal(&self, rhs: &str) -> BooleanChunked

Check for inequality.
source§

fn not_equal_missing(&self, rhs: &str) -> BooleanChunked

Check for inequality where None == None.
source§

fn gt(&self, rhs: &str) -> BooleanChunked

Greater than comparison.
source§

fn gt_eq(&self, rhs: &str) -> BooleanChunked

Greater than or equal comparison.
source§

fn lt(&self, rhs: &str) -> BooleanChunked

Less than comparison.
source§

fn lt_eq(&self, rhs: &str) -> BooleanChunked

Less than or equal comparison
source§

impl ChunkExpandAtIndex<StringType> for StringChunked

source§

fn new_from_index(&self, index: usize, length: usize) -> StringChunked

Create a new ChunkedArray filled with values at that index.
source§

impl ChunkExplode for StringChunked

source§

impl ChunkFilter<StringType> for StringChunked

source§

fn filter( &self, filter: &BooleanChunked ) -> PolarsResult<ChunkedArray<StringType>>

Filter values in the ChunkedArray with a boolean mask. Read more
source§

impl<'a> ChunkFull<&'a str> for StringChunked

source§

fn full(name: &str, value: &'a str, length: usize) -> Self

Create a ChunkedArray with a single value.
source§

impl ChunkFullNull for StringChunked

source§

fn full_null(name: &str, length: usize) -> Self

source§

impl ChunkQuantile<String> for StringChunked

source§

fn median(&self) -> Option<T>

Returns the mean value in the array. Returns None if the array is empty or only contains null values.
source§

fn quantile( &self, _quantile: f64, _interpol: QuantileInterpolOptions ) -> PolarsResult<Option<T>>

Aggregate a given quantile of the ChunkedArray. Returns None if the array is empty or only contains null values.
source§

impl ChunkReverse for StringChunked

source§

fn reverse(&self) -> Self

Return a reversed version of this array.
source§

impl<'a> ChunkSet<'a, &'a str, String> for StringChunked

source§

fn scatter_single<I: IntoIterator<Item = IdxSize>>( &'a self, idx: I, opt_value: Option<&'a str> ) -> PolarsResult<Self>
where Self: Sized,

Set the values at indexes idx to some optional value Option<T>. Read more
source§

fn scatter_with<I: IntoIterator<Item = IdxSize>, F>( &'a self, idx: I, f: F ) -> PolarsResult<Self>
where Self: Sized, F: Fn(Option<&'a str>) -> Option<String>,

Set the values at indexes idx by applying a closure to these values. Read more
source§

fn set( &'a self, mask: &BooleanChunked, value: Option<&'a str> ) -> PolarsResult<Self>
where Self: Sized,

Set the values where the mask evaluates to true to some optional value Option<T>. Read more
source§

impl ChunkShift<StringType> for StringChunked

source§

fn shift(&self, periods: i64) -> Self

source§

impl ChunkShiftFill<StringType, Option<&str>> for StringChunked

source§

fn shift_and_fill( &self, periods: i64, fill_value: Option<&str> ) -> StringChunked

Shift the values by a given period and fill the parts that will be empty due to this operation with fill_value.
source§

impl ChunkSort<StringType> for StringChunked

source§

fn arg_sort_multiple( &self, by: &[Series], options: &SortMultipleOptions ) -> PolarsResult<IdxCa>

§Panics

This function is very opinionated. On the implementation of ChunkedArray<T> for numeric types, we assume that all numeric Series are of the same type.

In this case we assume that all numeric Series are f64 types. The caller needs to uphold this contract. If not, it will panic.

source§

fn sort_with(&self, options: SortOptions) -> ChunkedArray<StringType>

source§

fn sort(&self, descending: bool) -> StringChunked

Returned a sorted ChunkedArray.
source§

fn arg_sort(&self, options: SortOptions) -> IdxCa

Retrieve the indexes needed to sort this array.
source§

impl ChunkTakeUnchecked<ChunkedArray<UInt32Type>> for StringChunked

source§

unsafe fn take_unchecked(&self, indices: &IdxCa) -> Self

Gather values from ChunkedArray by index. Read more
source§

impl ChunkUnique<StringType> for StringChunked

Available on crate feature algorithm_group_by only.
source§

fn unique(&self) -> PolarsResult<Self>

Get unique values of a ChunkedArray
source§

fn arg_unique(&self) -> PolarsResult<IdxCa>

Get first index of the unique values in a ChunkedArray. This Vec is sorted.
source§

fn n_unique(&self) -> PolarsResult<usize>

Number of unique values in the ChunkedArray
source§

impl ChunkVar for StringChunked

source§

fn var(&self, _ddof: u8) -> Option<f64>

Compute the variance of this ChunkedArray/Series.
source§

fn std(&self, _ddof: u8) -> Option<f64>

Compute the standard deviation of this ChunkedArray/Series.
source§

impl Debug for StringChunked

source§

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

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

impl<Ptr> FromIterator<Option<Ptr>> for StringChunked
where Ptr: AsRef<str>,

source§

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

Creates a value from an iterator. Read more
source§

impl<Ptr> FromIterator<Ptr> for StringChunked
where Ptr: PolarsAsRef<str>,

source§

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

Creates a value from an iterator. Read more
source§

impl<Ptr> FromParallelIterator<Option<Ptr>> for StringChunked
where Ptr: AsRef<str> + Send + Sync,

source§

fn from_par_iter<I: IntoParallelIterator<Item = Option<Ptr>>>(iter: I) -> Self

Creates an instance of the collection from the parallel iterator par_iter. Read more
source§

impl<Ptr> FromParallelIterator<Ptr> for StringChunked
where Ptr: PolarsAsRef<str> + Send + Sync,

source§

fn from_par_iter<I: IntoParallelIterator<Item = Ptr>>(iter: I) -> Self

Creates an instance of the collection from the parallel iterator par_iter. Read more
source§

impl<Ptr> FromTrustedLenIterator<Option<Ptr>> for StringChunked
where Ptr: AsRef<str>,

source§

fn from_iter_trusted_length<I: IntoIterator<Item = Option<Ptr>>>( iter: I ) -> Self

source§

impl<Ptr> FromTrustedLenIterator<Ptr> for StringChunked
where Ptr: PolarsAsRef<str>,

source§

fn from_iter_trusted_length<I: IntoIterator<Item = Ptr>>(iter: I) -> Self

source§

impl IntoGroupsProxy for StringChunked

Available on crate feature algorithm_group_by only.
source§

fn group_tuples<'a>( &'a self, multithreaded: bool, sorted: bool ) -> PolarsResult<GroupsProxy>

Create the tuples need for a group_by operation. * The first value in the tuple is the first index of the group. * The second value in the tuple is the indexes of the groups including the first value.
source§

impl<'a> IntoIterator for &'a StringChunked

§

type Item = Option<&'a str>

The type of the elements being iterated over.
§

type IntoIter = Box<dyn PolarsIterator<Item = <&'a ChunkedArray<StringType> as IntoIterator>::Item> + 'a>

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<'a, T: AsRef<[&'a str]>> NamedFrom<T, [&'a str]> for StringChunked

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<'a, T: AsRef<[Cow<'a, str>]>> NamedFrom<T, [Cow<'a, str>]> for StringChunked

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<'a, T: AsRef<[Option<&'a str>]>> NamedFrom<T, [Option<&'a str>]> for StringChunked

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<'a, T: AsRef<[Option<Cow<'a, str>>]>> NamedFrom<T, [Option<Cow<'a, str>>]> for StringChunked

source§

fn new(name: &str, v: T) -> Self

Initialize by name and values.
source§

impl<S> NewChunkedArray<StringType, S> for StringChunked
where S: AsRef<str>,

source§

fn from_iter_values(name: &str, it: impl Iterator<Item = S>) -> Self

Create a new ChunkedArray from an iterator.

source§

fn from_slice(name: &str, v: &[S]) -> Self

source§

fn from_slice_options(name: &str, opt_v: &[Option<S>]) -> Self

source§

fn from_iter_options(name: &str, it: impl Iterator<Item = Option<S>>) -> Self

Create a new ChunkedArray from an iterator.
source§

impl ValueSize for StringChunked

source§

fn get_values_size(&self) -> usize

Get the values size that is still “visible” to the underlying array. E.g. take the offsets into account.
source§

impl VecHash for StringChunked

source§

fn vec_hash( &self, random_state: RandomState, buf: &mut Vec<u64> ) -> PolarsResult<()>

Compute the hash for all values in the array. Read more
source§

fn vec_hash_combine( &self, random_state: RandomState, hashes: &mut [u64] ) -> PolarsResult<()>