Struct polars_core::series::Series
source · pub struct Series(pub Arc<dyn SeriesTrait>);
Expand description
§Series
The columnar data type for a DataFrame.
Most of the available functions are defined in the SeriesTrait trait.
The Series
struct consists
of typed ChunkedArray’s. To quickly cast
a Series
to a ChunkedArray
you can call the method with the name of the type:
let s: Series = [1, 2, 3].iter().collect();
// Quickly obtain the ChunkedArray wrapped by the Series.
let chunked_array = s.i32().unwrap();
§Arithmetic
You can do standard arithmetic on series.
let s = Series::new("a", [1 , 2, 3]);
let out_add = &s + &s;
let out_sub = &s - &s;
let out_div = &s / &s;
let out_mul = &s * &s;
Or with series and numbers.
let s: Series = (1..3).collect();
let out_add_one = &s + 1;
let out_multiply = &s * 10;
// Could not overload left hand side operator.
let out_divide = 1.div(&s);
let out_add = 1.add(&s);
let out_subtract = 1.sub(&s);
let out_multiply = 1.mul(&s);
§Comparison
You can obtain boolean mask by comparing series.
let s = Series::new("dollars", &[1, 2, 3]);
let mask = s.equal(1).unwrap();
let valid = [true, false, false].iter();
assert!(mask
.into_iter()
.map(|opt_bool| opt_bool.unwrap()) // option, because series can be null
.zip(valid)
.all(|(a, b)| a == *b))
See all the comparison operators in the CmpOps trait
§Iterators
The Series variants contain differently typed ChunkedArray’s. These structs can be turned into iterators, making it possible to use any function/ closure you want on a Series.
These iterators return an Option<T>
because the values of a series may be null.
use polars_core::prelude::*;
let pi = 3.14;
let s = Series::new("angle", [2f32 * pi, pi, 1.5 * pi].as_ref());
let s_cos: Series = s.f32()
.expect("series was not an f32 dtype")
.into_iter()
.map(|opt_angle| opt_angle.map(|angle| angle.cos()))
.collect();
§Creation
Series can be create from different data structures. Below we’ll show a few ways we can create a Series object.
// Series can be created from Vec's, slices and arrays
Series::new("boolean series", &[true, false, true]);
Series::new("int series", &[1, 2, 3]);
// And can be nullable
Series::new("got nulls", &[Some(1), None, Some(2)]);
// Series can also be collected from iterators
let from_iter: Series = (0..10)
.into_iter()
.collect();
Tuple Fields§
§0: Arc<dyn SeriesTrait>
Implementations§
source§impl Series
impl Series
sourcepub fn fill_null(&self, strategy: FillNullStrategy) -> PolarsResult<Series>
pub fn fill_null(&self, strategy: FillNullStrategy) -> PolarsResult<Series>
Replace None values with one of the following strategies:
- Forward fill (replace None with the previous value)
- Backward fill (replace None with the next value)
- Mean fill (replace None with the mean of the whole array)
- Min fill (replace None with the minimum of the whole array)
- Max fill (replace None with the maximum of the whole array)
- Zero fill (replace None with the value zero)
- One fill (replace None with the value one)
- MinBound fill (replace with the minimum of that data type)
- MaxBound fill (replace with the maximum of that data type)
NOTE: If you want to fill the Nones with a value use the
fill_null
operation on ChunkedArray<T>
.
§Example
fn example() -> PolarsResult<()> {
let s = Series::new("some_missing", &[Some(1), None, Some(2)]);
let filled = s.fill_null(FillNullStrategy::Forward(None))?;
assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(1), Some(2)]);
let filled = s.fill_null(FillNullStrategy::Backward(None))?;
assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(2), Some(2)]);
let filled = s.fill_null(FillNullStrategy::Min)?;
assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(1), Some(2)]);
let filled = s.fill_null(FillNullStrategy::Max)?;
assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(2), Some(2)]);
let filled = s.fill_null(FillNullStrategy::Mean)?;
assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(1), Some(2)]);
let filled = s.fill_null(FillNullStrategy::Zero)?;
assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(0), Some(2)]);
let filled = s.fill_null(FillNullStrategy::One)?;
assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(1), Some(2)]);
let filled = s.fill_null(FillNullStrategy::MinBound)?;
assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(-2147483648), Some(2)]);
let filled = s.fill_null(FillNullStrategy::MaxBound)?;
assert_eq!(Vec::from(filled.i32()?), &[Some(1), Some(2147483647), Some(2)]);
Ok(())
}
example();
source§impl Series
impl Series
pub fn sample_n( &self, n: usize, with_replacement: bool, shuffle: bool, seed: Option<u64> ) -> PolarsResult<Self>
random
only.sourcepub fn sample_frac(
&self,
frac: f64,
with_replacement: bool,
shuffle: bool,
seed: Option<u64>
) -> PolarsResult<Self>
Available on crate feature random
only.
pub fn sample_frac( &self, frac: f64, with_replacement: bool, shuffle: bool, seed: Option<u64> ) -> PolarsResult<Self>
random
only.Sample a fraction between 0.0-1.0 of this ChunkedArray
.
pub fn shuffle(&self, seed: Option<u64>) -> Self
random
only.source§impl Series
impl Series
sourcepub fn from_any_values(
name: &str,
values: &[AnyValue<'_>],
strict: bool
) -> PolarsResult<Self>
pub fn from_any_values( name: &str, values: &[AnyValue<'_>], strict: bool ) -> PolarsResult<Self>
Construct a new Series
from a slice of AnyValues.
The data type of the resulting Series is determined by the values
and the strict
parameter:
- If
strict
istrue
, the data type is equal to the data type of the first non-null value. If any other non-null values do not match this data type, an error is raised. - If
strict
isfalse
, the data type is the supertype of thevalues
. An error is returned if no supertype can be determined. WARNING: A full pass over the values is required to determine the supertype. - If no values were passed, the resulting data type is
Null
.
sourcepub fn from_any_values_and_dtype(
name: &str,
values: &[AnyValue<'_>],
dtype: &DataType,
strict: bool
) -> PolarsResult<Self>
pub fn from_any_values_and_dtype( name: &str, values: &[AnyValue<'_>], dtype: &DataType, strict: bool ) -> PolarsResult<Self>
Construct a new Series
with the given dtype
from a slice of AnyValues.
If strict
is true
, an error is returned if the values do not match the given
data type. If strict
is false
, values that do not match the given data type
are cast. If casting is not possible, the values are set to null instead.
source§impl Series
impl Series
pub fn try_sub(&self, rhs: &Self) -> PolarsResult<Self>
pub fn try_add(&self, rhs: &Self) -> PolarsResult<Self>
pub fn try_mul(&self, rhs: &Self) -> PolarsResult<Self>
pub fn try_div(&self, rhs: &Self) -> PolarsResult<Self>
pub fn try_rem(&self, rhs: &Self) -> PolarsResult<Self>
source§impl Series
impl Series
pub fn try_add_owned(self, other: Self) -> PolarsResult<Self>
pub fn try_sub_owned(self, other: Self) -> PolarsResult<Self>
pub fn try_mul_owned(self, other: Self) -> PolarsResult<Self>
source§impl Series
impl Series
sourcepub unsafe fn from_chunks_and_dtype_unchecked(
name: &str,
chunks: Vec<ArrayRef>,
dtype: &DataType
) -> Self
pub unsafe fn from_chunks_and_dtype_unchecked( name: &str, chunks: Vec<ArrayRef>, dtype: &DataType ) -> Self
Takes chunks and a polars datatype and constructs the Series This is faster than creating from chunks and an arrow datatype because there is no casting involved
§Safety
The caller must ensure that the given dtype
’s physical type matches all the ArrayRef
dtypes.
sourcepub unsafe fn _try_from_arrow_unchecked(
name: &str,
chunks: Vec<ArrayRef>,
dtype: &ArrowDataType
) -> PolarsResult<Self>
pub unsafe fn _try_from_arrow_unchecked( name: &str, chunks: Vec<ArrayRef>, dtype: &ArrowDataType ) -> PolarsResult<Self>
§Safety
The caller must ensure that the given dtype
matches all the ArrayRef
dtypes.
sourcepub unsafe fn _try_from_arrow_unchecked_with_md(
name: &str,
chunks: Vec<ArrayRef>,
dtype: &ArrowDataType,
md: Option<&Metadata>
) -> PolarsResult<Self>
pub unsafe fn _try_from_arrow_unchecked_with_md( name: &str, chunks: Vec<ArrayRef>, dtype: &ArrowDataType, md: Option<&Metadata> ) -> PolarsResult<Self>
Create a new Series without checking if the inner dtype of the chunks is correct
§Safety
The caller must ensure that the given dtype
matches all the ArrayRef
dtypes.
source§impl Series
impl Series
source§impl Series
impl Series
sourcepub fn iter(&self) -> SeriesIter<'_> ⓘ
pub fn iter(&self) -> SeriesIter<'_> ⓘ
pub fn phys_iter(&self) -> SeriesPhysIter<'_>
source§impl Series
impl Series
sourcepub fn i8(&self) -> PolarsResult<&Int8Chunked>
pub fn i8(&self) -> PolarsResult<&Int8Chunked>
Unpack to ChunkedArray
of dtype [DataType::Int8]
sourcepub fn i16(&self) -> PolarsResult<&Int16Chunked>
pub fn i16(&self) -> PolarsResult<&Int16Chunked>
Unpack to ChunkedArray
of dtype [DataType::Int16]
sourcepub fn i32(&self) -> PolarsResult<&Int32Chunked>
pub fn i32(&self) -> PolarsResult<&Int32Chunked>
Unpack to ChunkedArray
let s = Series::new("foo", [1i32 ,2, 3]);
let s_squared: Series = s.i32()
.unwrap()
.into_iter()
.map(|opt_v| {
match opt_v {
Some(v) => Some(v * v),
None => None, // null value
}
}).collect();
Unpack to ChunkedArray
of dtype [DataType::Int32]
sourcepub fn i64(&self) -> PolarsResult<&Int64Chunked>
pub fn i64(&self) -> PolarsResult<&Int64Chunked>
Unpack to ChunkedArray
of dtype [DataType::Int64]
sourcepub fn f32(&self) -> PolarsResult<&Float32Chunked>
pub fn f32(&self) -> PolarsResult<&Float32Chunked>
Unpack to ChunkedArray
of dtype [DataType::Float32]
sourcepub fn f64(&self) -> PolarsResult<&Float64Chunked>
pub fn f64(&self) -> PolarsResult<&Float64Chunked>
Unpack to ChunkedArray
of dtype [DataType::Float64]
sourcepub fn u8(&self) -> PolarsResult<&UInt8Chunked>
pub fn u8(&self) -> PolarsResult<&UInt8Chunked>
Unpack to ChunkedArray
of dtype [DataType::UInt8]
sourcepub fn u16(&self) -> PolarsResult<&UInt16Chunked>
pub fn u16(&self) -> PolarsResult<&UInt16Chunked>
Unpack to ChunkedArray
of dtype [DataType::UInt16]
sourcepub fn u32(&self) -> PolarsResult<&UInt32Chunked>
pub fn u32(&self) -> PolarsResult<&UInt32Chunked>
Unpack to ChunkedArray
of dtype [DataType::UInt32]
sourcepub fn u64(&self) -> PolarsResult<&UInt64Chunked>
pub fn u64(&self) -> PolarsResult<&UInt64Chunked>
Unpack to ChunkedArray
of dtype [DataType::UInt64]
sourcepub fn bool(&self) -> PolarsResult<&BooleanChunked>
pub fn bool(&self) -> PolarsResult<&BooleanChunked>
Unpack to ChunkedArray
of dtype [DataType::Boolean]
sourcepub fn str(&self) -> PolarsResult<&StringChunked>
pub fn str(&self) -> PolarsResult<&StringChunked>
Unpack to ChunkedArray
of dtype [DataType::String]
sourcepub fn binary(&self) -> PolarsResult<&BinaryChunked>
pub fn binary(&self) -> PolarsResult<&BinaryChunked>
Unpack to ChunkedArray
of dtype [DataType::Binary]
sourcepub fn binary_offset(&self) -> PolarsResult<&BinaryOffsetChunked>
pub fn binary_offset(&self) -> PolarsResult<&BinaryOffsetChunked>
Unpack to ChunkedArray
of dtype [DataType::Binary]
sourcepub fn decimal(&self) -> PolarsResult<&DecimalChunked>
Available on crate feature dtype-decimal
only.
pub fn decimal(&self) -> PolarsResult<&DecimalChunked>
dtype-decimal
only.Unpack to ChunkedArray
of dtype [DataType::Decimal]
sourcepub fn list(&self) -> PolarsResult<&ListChunked>
pub fn list(&self) -> PolarsResult<&ListChunked>
Unpack to ChunkedArray
of dtype list
sourcepub fn categorical(&self) -> PolarsResult<&CategoricalChunked>
Available on crate feature dtype-categorical
only.
pub fn categorical(&self) -> PolarsResult<&CategoricalChunked>
dtype-categorical
only.Unpack to ChunkedArray
of dtype [DataType::Categorical]
sourcepub fn null(&self) -> PolarsResult<&NullChunked>
pub fn null(&self) -> PolarsResult<&NullChunked>
Unpack to ChunkedArray
of dtype [DataType::Null]
source§impl Series
impl Series
sourcepub fn extend_constant(
&self,
value: AnyValue<'_>,
n: usize
) -> PolarsResult<Self>
pub fn extend_constant( &self, value: AnyValue<'_>, n: usize ) -> PolarsResult<Self>
Extend with a constant value.
source§impl Series
impl Series
sourcepub fn get_leaf_array(&self) -> Series
pub fn get_leaf_array(&self) -> Series
Recurse nested types until we are at the leaf array.
sourcepub fn implode(&self) -> PolarsResult<ListChunked>
pub fn implode(&self) -> PolarsResult<ListChunked>
Convert the values of this Series to a ListChunked with a length of 1,
so a Series of [1, 2, 3]
becomes [[1, 2, 3]]
.
pub fn reshape_list(&self, dimensions: &[i64]) -> PolarsResult<Series>
source§impl Series
impl Series
pub fn clear(&self) -> Series
sourcepub unsafe fn chunks_mut(&mut self) -> &mut Vec<ArrayRef>
pub unsafe fn chunks_mut(&mut self) -> &mut Vec<ArrayRef>
§Safety
The caller must ensure the length and the data types of ArrayRef
does not change.
And that the null_count is updated (e.g. with a compute_len()
)
pub fn select_chunk(&self, i: usize) -> Self
pub fn is_sorted_flag(&self) -> IsSorted
pub fn set_sorted_flag(&mut self, sorted: IsSorted)
pub fn get_flags(&self) -> MetadataFlags
pub fn into_frame(self) -> DataFrame
sourcepub fn try_set_metadata<T: PolarsDataType + 'static>(
&mut self,
metadata: Metadata<T>
) -> bool
pub fn try_set_metadata<T: PolarsDataType + 'static>( &mut self, metadata: Metadata<T> ) -> bool
Try to set the Metadata
for the underlying ChunkedArray
This does not guarantee that the Metadata
is always set. It returns whether it was
successful.
pub fn from_arrow_chunks( name: &str, arrays: Vec<ArrayRef> ) -> PolarsResult<Series>
pub fn from_arrow(name: &str, array: ArrayRef) -> PolarsResult<Series>
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrink the capacity of this array to fit its length.
sourcepub fn append(&mut self, other: &Series) -> PolarsResult<&mut Self>
pub fn append(&mut self, other: &Series) -> PolarsResult<&mut Self>
Append in place. This is done by adding the chunks of other
to this Series
.
See ChunkedArray::append
and ChunkedArray::extend
.
sourcepub fn compute_len(&mut self)
pub fn compute_len(&mut self)
Redo a length and null_count compute
sourcepub fn extend(&mut self, other: &Series) -> PolarsResult<&mut Self>
pub fn extend(&mut self, other: &Series) -> PolarsResult<&mut Self>
Extend the memory backed by this array with the values from other
.
See ChunkedArray::extend
and ChunkedArray::append
.
sourcepub fn sort(&self, sort_options: SortOptions) -> PolarsResult<Self>
pub fn sort(&self, sort_options: SortOptions) -> PolarsResult<Self>
Sort the series with specific options.
§Example
let s = Series::new("foo", [2, 1, 3]);
let sorted = s.sort(SortOptions::default())?;
assert_eq!(sorted, Series::new("foo", [1, 2, 3]));
}
See SortOptions
for more options.
sourcepub fn as_single_ptr(&mut self) -> PolarsResult<usize>
pub fn as_single_ptr(&mut self) -> PolarsResult<usize>
Only implemented for numeric types
pub fn cast(&self, dtype: &DataType) -> PolarsResult<Self>
sourcepub fn cast_with_options(
&self,
dtype: &DataType,
options: CastOptions
) -> PolarsResult<Self>
pub fn cast_with_options( &self, dtype: &DataType, options: CastOptions ) -> PolarsResult<Self>
Cast [Series]
to another [DataType]
.
sourcepub unsafe fn cast_unchecked(&self, dtype: &DataType) -> PolarsResult<Self>
pub unsafe fn cast_unchecked(&self, dtype: &DataType) -> PolarsResult<Self>
Cast from physical to logical types without any checks on the validity of the cast.
§Safety
This can lead to invalid memory access in downstream code.
sourcepub fn to_float(&self) -> PolarsResult<Series>
pub fn to_float(&self) -> PolarsResult<Series>
Cast numerical types to f64, and keep floats as is.
sourcepub fn sum<T>(&self) -> PolarsResult<T>where
T: NumCast,
pub fn sum<T>(&self) -> PolarsResult<T>where
T: NumCast,
Compute the sum of all values in this Series.
Returns Some(0)
if the array is empty, and None
if the array only
contains null values.
If the DataType
is one of {Int8, UInt8, Int16, UInt16}
the Series
is
first cast to Int64
to prevent overflow issues.
sourcepub fn min<T>(&self) -> PolarsResult<Option<T>>where
T: NumCast,
pub fn min<T>(&self) -> PolarsResult<Option<T>>where
T: NumCast,
Returns the minimum value in the array, according to the natural order. Returns an option because the array is nullable.
sourcepub fn max<T>(&self) -> PolarsResult<Option<T>>where
T: NumCast,
pub fn max<T>(&self) -> PolarsResult<Option<T>>where
T: NumCast,
Returns the maximum value in the array, according to the natural order. Returns an option because the array is nullable.
sourcepub fn explode(&self) -> PolarsResult<Series>
pub fn explode(&self) -> PolarsResult<Series>
Explode a list Series. This expands every item to a new row..
sourcepub fn is_nan(&self) -> PolarsResult<BooleanChunked>
pub fn is_nan(&self) -> PolarsResult<BooleanChunked>
Check if float value is NaN (note this is different than missing/ null)
sourcepub fn is_not_nan(&self) -> PolarsResult<BooleanChunked>
pub fn is_not_nan(&self) -> PolarsResult<BooleanChunked>
Check if float value is NaN (note this is different than missing/ null)
sourcepub fn is_finite(&self) -> PolarsResult<BooleanChunked>
pub fn is_finite(&self) -> PolarsResult<BooleanChunked>
Check if numeric value is finite
sourcepub fn is_infinite(&self) -> PolarsResult<BooleanChunked>
pub fn is_infinite(&self) -> PolarsResult<BooleanChunked>
Check if float value is infinite
sourcepub fn zip_with(
&self,
mask: &BooleanChunked,
other: &Series
) -> PolarsResult<Series>
Available on crate feature zip_with
only.
pub fn zip_with( &self, mask: &BooleanChunked, other: &Series ) -> PolarsResult<Series>
zip_with
only.Create a new ChunkedArray with values from self where the mask evaluates true
and values
from other
where the mask evaluates false
. This function automatically broadcasts unit
length inputs.
sourcepub fn to_physical_repr(&self) -> Cow<'_, Series>
pub fn to_physical_repr(&self) -> Cow<'_, Series>
Cast a datelike Series to their physical representation. Primitives remain unchanged
- Date -> Int32
- Datetime-> Int64
- Time -> Int64
- Categorical -> UInt32
- List(inner) -> List(physical of inner)
sourcepub unsafe fn take_unchecked_from_slice(&self, idx: &[IdxSize]) -> Series
pub unsafe fn take_unchecked_from_slice(&self, idx: &[IdxSize]) -> Series
Take by index if ChunkedArray contains a single chunk.
§Safety
This doesn’t check any bounds. Null validity is checked.
sourcepub fn gather_every(&self, n: usize, offset: usize) -> Series
pub fn gather_every(&self, n: usize, offset: usize) -> Series
Traverse and collect every nth element in a new array.
pub fn dot(&self, other: &Series) -> PolarsResult<f64>
dot_product
only.sourcepub fn sum_reduce(&self) -> PolarsResult<Scalar>
pub fn sum_reduce(&self) -> PolarsResult<Scalar>
Get the sum of the Series as a new Series of length 1. Returns a Series with a single zeroed entry if self is an empty numeric series.
If the DataType
is one of {Int8, UInt8, Int16, UInt16}
the Series
is
first cast to Int64
to prevent overflow issues.
sourcepub fn product(&self) -> PolarsResult<Scalar>
pub fn product(&self) -> PolarsResult<Scalar>
Get the product of an array.
If the DataType
is one of {Int8, UInt8, Int16, UInt16}
the Series
is
first cast to Int64
to prevent overflow issues.
sourcepub fn strict_cast(&self, dtype: &DataType) -> PolarsResult<Series>
pub fn strict_cast(&self, dtype: &DataType) -> PolarsResult<Series>
Cast throws an error if conversion had overflows
pub fn str_value(&self, index: usize) -> PolarsResult<Cow<'_, str>>
pub fn mean_reduce(&self) -> Scalar
sourcepub fn unique_stable(&self) -> PolarsResult<Series>
pub fn unique_stable(&self) -> PolarsResult<Series>
Compute the unique elements, but maintain order. This requires more work
than a naive Series::unique
.
pub fn idx(&self) -> PolarsResult<&IdxCa>
sourcepub fn estimated_size(&self) -> usize
pub fn estimated_size(&self) -> usize
Returns an estimation of the total (heap) allocated size of the Series
in bytes.
§Implementation
This estimation is the sum of the size of its buffers, validity, including nested arrays.
Multiple arrays may share buffers and bitmaps. Therefore, the size of 2 arrays is not the
sum of the sizes computed from this function. In particular, [StructArray
]’s size is an upper bound.
When an array is sliced, its allocated size remains constant because the buffer unchanged. However, this function will yield a smaller number. This is because this function returns the visible size of the buffer, not its total capacity.
FFI buffers are included in this estimation.
sourcepub fn as_list(&self) -> ListChunked
pub fn as_list(&self) -> ListChunked
Packs every element into a list.
source§impl Series
impl Series
sourcepub fn equals(&self, other: &Series) -> bool
pub fn equals(&self, other: &Series) -> bool
Check if series are equal. Note that None == None
evaluates to false
sourcepub fn equals_missing(&self, other: &Series) -> bool
pub fn equals_missing(&self, other: &Series) -> bool
Check if all values in series are equal where None == None
evaluates to true
.
sourcepub fn get_data_ptr(&self) -> usize
pub fn get_data_ptr(&self) -> usize
Get a pointer to the underlying data of this Series
.
Can be useful for fast comparisons.
Methods from Deref<Target = dyn SeriesTrait>§
pub fn unpack<N>(&self) -> PolarsResult<&ChunkedArray<N>>where
N: 'static + PolarsDataType,
Trait Implementations§
source§impl AsRef<Series> for AmortSeries
impl AsRef<Series> for AmortSeries
We don’t implement Deref so that the caller is aware of converting to Series
source§impl<'a> AsRef<dyn SeriesTrait + 'a> for Series
impl<'a> AsRef<dyn SeriesTrait + 'a> for Series
source§fn as_ref(&self) -> &(dyn SeriesTrait + 'a)
fn as_ref(&self) -> &(dyn SeriesTrait + 'a)
source§impl<'a> ChunkApply<'a, Series> for ListChunked
impl<'a> ChunkApply<'a, Series> for ListChunked
source§impl ChunkCompare<&Series> for Series
impl ChunkCompare<&Series> for Series
source§fn equal(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
fn equal(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
Create a boolean mask by checking for equality.
source§fn equal_missing(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
fn equal_missing(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
Create a boolean mask by checking for equality.
source§fn not_equal(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
fn not_equal(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
Create a boolean mask by checking for inequality.
source§fn not_equal_missing(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
fn not_equal_missing(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
Create a boolean mask by checking for inequality.
source§fn gt(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
fn gt(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
Create a boolean mask by checking if self > rhs.
source§fn gt_eq(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
fn gt_eq(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
Create a boolean mask by checking if self >= rhs.
source§fn lt(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
fn lt(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
Create a boolean mask by checking if self < rhs.
source§fn lt_eq(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
fn lt_eq(&self, rhs: &Series) -> PolarsResult<BooleanChunked>
Create a boolean mask by checking if self <= rhs.
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
source§impl ChunkCompare<&str> for Series
impl ChunkCompare<&str> for Series
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
source§fn equal(&self, rhs: &str) -> PolarsResult<BooleanChunked>
fn equal(&self, rhs: &str) -> PolarsResult<BooleanChunked>
source§fn equal_missing(&self, rhs: &str) -> Self::Item
fn equal_missing(&self, rhs: &str) -> Self::Item
None == None
.source§fn not_equal(&self, rhs: &str) -> PolarsResult<BooleanChunked>
fn not_equal(&self, rhs: &str) -> PolarsResult<BooleanChunked>
source§fn not_equal_missing(&self, rhs: &str) -> Self::Item
fn not_equal_missing(&self, rhs: &str) -> Self::Item
None == None
.source§fn gt(&self, rhs: &str) -> PolarsResult<BooleanChunked>
fn gt(&self, rhs: &str) -> PolarsResult<BooleanChunked>
source§impl<Rhs> ChunkCompare<Rhs> for Serieswhere
Rhs: NumericNative,
impl<Rhs> ChunkCompare<Rhs> for Serieswhere
Rhs: NumericNative,
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
source§fn equal(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
fn equal(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
source§fn equal_missing(&self, rhs: Rhs) -> Self::Item
fn equal_missing(&self, rhs: Rhs) -> Self::Item
None == None
.source§fn not_equal(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
fn not_equal(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
source§fn not_equal_missing(&self, rhs: Rhs) -> Self::Item
fn not_equal_missing(&self, rhs: Rhs) -> Self::Item
None == None
.source§fn gt(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
fn gt(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
source§fn gt_eq(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
fn gt_eq(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
source§fn lt(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
fn lt(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
source§fn lt_eq(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
fn lt_eq(&self, rhs: Rhs) -> PolarsResult<BooleanChunked>
source§impl ChunkFull<&Series> for ListChunked
impl ChunkFull<&Series> for ListChunked
source§impl ChunkQuantile<Series> for ListChunked
impl ChunkQuantile<Series> for ListChunked
source§fn median(&self) -> Option<T>
fn median(&self) -> Option<T>
None
if the array is empty or only contains null values.source§fn quantile(
&self,
_quantile: f64,
_interpol: QuantileInterpolOptions
) -> PolarsResult<Option<T>>
fn quantile( &self, _quantile: f64, _interpol: QuantileInterpolOptions ) -> PolarsResult<Option<T>>
None
if the array is empty or only contains null values.source§impl<T: PolarsObject> ChunkQuantile<Series> for ObjectChunked<T>
Available on crate feature object
only.
impl<T: PolarsObject> ChunkQuantile<Series> for ObjectChunked<T>
object
only.source§fn median(&self) -> Option<T>
fn median(&self) -> Option<T>
None
if the array is empty or only contains null values.source§fn quantile(
&self,
_quantile: f64,
_interpol: QuantileInterpolOptions
) -> PolarsResult<Option<T>>
fn quantile( &self, _quantile: f64, _interpol: QuantileInterpolOptions ) -> PolarsResult<Option<T>>
None
if the array is empty or only contains null values.source§impl<T> From<ChunkedArray<T>> for Series
impl<T> From<ChunkedArray<T>> for Series
source§fn from(ca: ChunkedArray<T>) -> Self
fn from(ca: ChunkedArray<T>) -> Self
source§impl<'a> FromIterator<&'a bool> for Series
impl<'a> FromIterator<&'a bool> for Series
source§impl<'a> FromIterator<&'a f32> for Series
impl<'a> FromIterator<&'a f32> for Series
source§impl<'a> FromIterator<&'a f64> for Series
impl<'a> FromIterator<&'a f64> for Series
source§impl<'a> FromIterator<&'a i32> for Series
impl<'a> FromIterator<&'a i32> for Series
source§impl<'a> FromIterator<&'a i64> for Series
impl<'a> FromIterator<&'a i64> for Series
source§impl<'a> FromIterator<&'a str> for Series
impl<'a> FromIterator<&'a str> for Series
source§impl<'a> FromIterator<&'a u32> for Series
impl<'a> FromIterator<&'a u32> for Series
source§impl<'a> FromIterator<&'a u64> for Series
impl<'a> FromIterator<&'a u64> for Series
source§impl FromIterator<Series> for DataFrame
impl FromIterator<Series> for DataFrame
source§impl FromIterator<String> for Series
impl FromIterator<String> for Series
source§impl FromIterator<bool> for Series
impl FromIterator<bool> for Series
source§impl FromIterator<f32> for Series
impl FromIterator<f32> for Series
source§impl FromIterator<f64> for Series
impl FromIterator<f64> for Series
source§impl FromIterator<i32> for Series
impl FromIterator<i32> for Series
source§impl FromIterator<i64> for Series
impl FromIterator<i64> for Series
source§impl FromIterator<u32> for Series
impl FromIterator<u32> for Series
source§impl FromIterator<u64> for Series
impl FromIterator<u64> for Series
source§impl<T: IntoSeries> NamedFrom<T, T> for Series
impl<T: IntoSeries> NamedFrom<T, T> for Series
For any ChunkedArray
and Series
source§impl NumOpsDispatchChecked for Series
Available on crate feature checked_arithmetic
only.
impl NumOpsDispatchChecked for Series
checked_arithmetic
only.source§fn checked_div(&self, rhs: &Series) -> PolarsResult<Series>
fn checked_div(&self, rhs: &Series) -> PolarsResult<Series>
fn checked_div_num<T: ToPrimitive>(&self, rhs: T) -> PolarsResult<Series>
source§impl PartialEq for Series
impl PartialEq for Series
source§impl TryFrom<(&Field, Box<dyn Array>)> for Series
impl TryFrom<(&Field, Box<dyn Array>)> for Series
§type Error = PolarsError
type Error = PolarsError
source§fn try_from(field_arr: (&ArrowField, ArrayRef)) -> PolarsResult<Self>
fn try_from(field_arr: (&ArrowField, ArrayRef)) -> PolarsResult<Self>
source§impl TryFrom<(&Field, Vec<Box<dyn Array>>)> for Series
impl TryFrom<(&Field, Vec<Box<dyn Array>>)> for Series
§type Error = PolarsError
type Error = PolarsError
source§fn try_from(field_arr: (&ArrowField, Vec<ArrayRef>)) -> PolarsResult<Self>
fn try_from(field_arr: (&ArrowField, Vec<ArrayRef>)) -> PolarsResult<Self>
Auto Trait Implementations§
impl Freeze for Series
impl !RefUnwindSafe for Series
impl Send for Series
impl Sync for Series
impl Unpin for Series
impl !UnwindSafe for Series
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
source§impl<A, T, E> FromFallibleIterator<A, E> for Twhere
T: FromIterator<A>,
E: Error,
impl<A, T, E> FromFallibleIterator<A, E> for Twhere
T: FromIterator<A>,
E: Error,
fn from_fallible_iter<F>(iter: F) -> Result<T, E>where
F: FallibleIterator<E, Item = A>,
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>
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>
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