pub struct Series(pub Arc<dyn SeriesTrait, Global>);
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, Global>
Implementations§
source§impl Series
impl Series
sourcepub fn fill_null(
&self,
strategy: FillNullStrategy
) -> Result<Series, PolarsError>
pub fn fill_null( &self, strategy: FillNullStrategy ) -> Result<Series, PolarsError>
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)
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)]);
Ok(())
}
example();
source§impl Series
impl Series
sourcepub fn take_every(&self, n: usize) -> Series
pub fn take_every(&self, n: usize) -> Series
Traverse and collect every nth element in a new array.
source§impl Series
impl Series
pub fn sample_n( &self, n: usize, with_replacement: bool, shuffle: bool, seed: Option<u64> ) -> Result<Series, PolarsError>
sourcepub fn sample_frac(
&self,
frac: f64,
with_replacement: bool,
shuffle: bool,
seed: Option<u64>
) -> Result<Series, PolarsError>
pub fn sample_frac( &self, frac: f64, with_replacement: bool, shuffle: bool, seed: Option<u64> ) -> Result<Series, PolarsError>
Sample a fraction between 0.0-1.0 of this ChunkedArray
.
pub fn shuffle(&self, seed: Option<u64>) -> Series
source§impl Series
impl Series
pub fn from_any_values_and_dtype( name: &str, av: &[AnyValue<'_>], dtype: &DataType, strict: bool ) -> Result<Series, PolarsError>
pub fn from_any_values( name: &str, avs: &[AnyValue<'_>], strict: bool ) -> Result<Series, PolarsError>
source§impl Series
impl Series
sourcepub unsafe fn from_chunks_and_dtype_unchecked(
name: &str,
chunks: Vec<Box<dyn Array, Global>, Global>,
dtype: &DataType
) -> Series
pub unsafe fn from_chunks_and_dtype_unchecked( name: &str, chunks: Vec<Box<dyn Array, Global>, Global>, dtype: &DataType ) -> Series
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.
source§impl Series
impl Series
source§impl Series
impl Series
pub fn diff( &self, n: i64, null_behavior: NullBehavior ) -> Result<Series, PolarsError>
source§impl Series
impl Series
sourcepub fn i8(&self) -> Result<&ChunkedArray<Int8Type>, PolarsError>
pub fn i8(&self) -> Result<&ChunkedArray<Int8Type>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::Int8]
sourcepub fn i16(&self) -> Result<&ChunkedArray<Int16Type>, PolarsError>
pub fn i16(&self) -> Result<&ChunkedArray<Int16Type>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::Int16]
sourcepub fn i32(&self) -> Result<&ChunkedArray<Int32Type>, PolarsError>
pub fn i32(&self) -> Result<&ChunkedArray<Int32Type>, PolarsError>
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) -> Result<&ChunkedArray<Int64Type>, PolarsError>
pub fn i64(&self) -> Result<&ChunkedArray<Int64Type>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::Int64]
sourcepub fn f32(&self) -> Result<&ChunkedArray<Float32Type>, PolarsError>
pub fn f32(&self) -> Result<&ChunkedArray<Float32Type>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::Float32]
sourcepub fn f64(&self) -> Result<&ChunkedArray<Float64Type>, PolarsError>
pub fn f64(&self) -> Result<&ChunkedArray<Float64Type>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::Float64]
sourcepub fn u8(&self) -> Result<&ChunkedArray<UInt8Type>, PolarsError>
pub fn u8(&self) -> Result<&ChunkedArray<UInt8Type>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::UInt8]
sourcepub fn u16(&self) -> Result<&ChunkedArray<UInt16Type>, PolarsError>
pub fn u16(&self) -> Result<&ChunkedArray<UInt16Type>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::UInt16]
sourcepub fn u32(&self) -> Result<&ChunkedArray<UInt32Type>, PolarsError>
pub fn u32(&self) -> Result<&ChunkedArray<UInt32Type>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::UInt32]
sourcepub fn u64(&self) -> Result<&ChunkedArray<UInt64Type>, PolarsError>
pub fn u64(&self) -> Result<&ChunkedArray<UInt64Type>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::UInt64]
sourcepub fn bool(&self) -> Result<&ChunkedArray<BooleanType>, PolarsError>
pub fn bool(&self) -> Result<&ChunkedArray<BooleanType>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::Boolean]
sourcepub fn utf8(&self) -> Result<&ChunkedArray<Utf8Type>, PolarsError>
pub fn utf8(&self) -> Result<&ChunkedArray<Utf8Type>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::Utf8]
sourcepub fn binary(&self) -> Result<&ChunkedArray<BinaryType>, PolarsError>
pub fn binary(&self) -> Result<&ChunkedArray<BinaryType>, PolarsError>
Unpack to ChunkedArray
of dtype [DataType::Binary]
sourcepub fn time(&self) -> Result<&Logical<TimeType, Int64Type>, PolarsError>
Available on crate feature dtype-time
only.
pub fn time(&self) -> Result<&Logical<TimeType, Int64Type>, PolarsError>
dtype-time
only.Unpack to ChunkedArray
of dtype [DataType::Time]
sourcepub fn date(&self) -> Result<&Logical<DateType, Int32Type>, PolarsError>
Available on crate feature dtype-date
only.
pub fn date(&self) -> Result<&Logical<DateType, Int32Type>, PolarsError>
dtype-date
only.Unpack to ChunkedArray
of dtype [DataType::Date]
sourcepub fn datetime(&self) -> Result<&Logical<DatetimeType, Int64Type>, PolarsError>
Available on crate feature dtype-datetime
only.
pub fn datetime(&self) -> Result<&Logical<DatetimeType, Int64Type>, PolarsError>
dtype-datetime
only.Unpack to ChunkedArray
of dtype [DataType::Datetime]
sourcepub fn duration(&self) -> Result<&Logical<DurationType, Int64Type>, PolarsError>
Available on crate feature dtype-duration
only.
pub fn duration(&self) -> Result<&Logical<DurationType, Int64Type>, PolarsError>
dtype-duration
only.Unpack to ChunkedArray
of dtype [DataType::Duration]
sourcepub fn decimal(&self) -> Result<&Logical<DecimalType, Int128Type>, PolarsError>
Available on crate feature dtype-decimal
only.
pub fn decimal(&self) -> Result<&Logical<DecimalType, Int128Type>, PolarsError>
dtype-decimal
only.Unpack to ChunkedArray
of dtype [DataType::Decimal]
sourcepub fn list(&self) -> Result<&ChunkedArray<ListType>, PolarsError>
pub fn list(&self) -> Result<&ChunkedArray<ListType>, PolarsError>
Unpack to ChunkedArray
of dtype list
sourcepub fn array(&self) -> Result<&ChunkedArray<FixedSizeListType>, PolarsError>
Available on crate feature dtype-array
only.
pub fn array(&self) -> Result<&ChunkedArray<FixedSizeListType>, PolarsError>
dtype-array
only.Unpack to ChunkedArray
of dtype [DataType::Array]
sourcepub fn categorical(&self) -> Result<&CategoricalChunked, PolarsError>
Available on crate feature dtype-categorical
only.
pub fn categorical(&self) -> Result<&CategoricalChunked, PolarsError>
dtype-categorical
only.Unpack to ChunkedArray
of dtype [DataType::Categorical]
sourcepub fn struct_(&self) -> Result<&StructChunked, PolarsError>
Available on crate feature dtype-struct
only.
pub fn struct_(&self) -> Result<&StructChunked, PolarsError>
dtype-struct
only.Unpack to ChunkedArray
of dtype [DataType::Struct]
source§impl Series
impl Series
sourcepub fn extend_constant(
&self,
value: AnyValue<'_>,
n: usize
) -> Result<Series, PolarsError>
pub fn extend_constant( &self, value: AnyValue<'_>, n: usize ) -> Result<Series, PolarsError>
Extend with a constant value.
source§impl Series
impl Series
sourcepub fn round(&self, decimals: u32) -> Result<Series, PolarsError>
pub fn round(&self, decimals: u32) -> Result<Series, PolarsError>
Round underlying floating point array to given decimal.
sourcepub fn floor(&self) -> Result<Series, PolarsError>
pub fn floor(&self) -> Result<Series, PolarsError>
Floor underlying floating point array to the lowest integers smaller or equal to the float value.
sourcepub fn ceil(&self) -> Result<Series, PolarsError>
pub fn ceil(&self) -> Result<Series, PolarsError>
Ceil underlying floating point array to the highest integers smaller or equal to the float value.
sourcepub fn clip(
self,
min: AnyValue<'_>,
max: AnyValue<'_>
) -> Result<Series, PolarsError>
pub fn clip( self, min: AnyValue<'_>, max: AnyValue<'_> ) -> Result<Series, PolarsError>
Clamp underlying values to the min
and max
values.
source§impl Series
impl Series
sourcepub fn implode(&self) -> Result<ChunkedArray<ListType>, PolarsError>
pub fn implode(&self) -> Result<ChunkedArray<ListType>, PolarsError>
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(&self, dims: &[i64]) -> Result<Series, PolarsError>
source§impl Series
impl Series
pub fn clear(&self) -> Series
sourcepub unsafe fn chunks_mut(&mut self) -> &mut Vec<Box<dyn Array, Global>, Global>
pub unsafe fn chunks_mut(&mut self) -> &mut Vec<Box<dyn Array, Global>, Global>
Safety
The caller must ensure the length and the data types of ArrayRef
does not change.
pub fn is_sorted_flag(&self) -> IsSorted
pub fn set_sorted_flag(&mut self, sorted: IsSorted)
pub fn get_flags(&self) -> Settings
pub fn into_frame(self) -> DataFrame
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) -> Result<&mut Series, PolarsError>
pub fn append(&mut self, other: &Series) -> Result<&mut Series, PolarsError>
Append in place. This is done by adding the chunks of other
to this Series
.
See ChunkedArray::append
and ChunkedArray::extend
.
sourcepub fn extend(&mut self, other: &Series) -> Result<&mut Series, PolarsError>
pub fn extend(&mut self, other: &Series) -> Result<&mut Series, PolarsError>
Extend the memory backed by this array with the values from other
.
See ChunkedArray::extend
and ChunkedArray::append
.
pub fn sort(&self, descending: bool) -> Series
sourcepub fn as_single_ptr(&mut self) -> Result<usize, PolarsError>
pub fn as_single_ptr(&mut self) -> Result<usize, PolarsError>
Only implemented for numeric types
sourcepub fn cast(&self, dtype: &DataType) -> Result<Series, PolarsError>
pub fn cast(&self, dtype: &DataType) -> Result<Series, PolarsError>
Cast [Series]
to another [DataType]
.
sourcepub unsafe fn cast_unchecked(
&self,
dtype: &DataType
) -> Result<Series, PolarsError>
pub unsafe fn cast_unchecked( &self, dtype: &DataType ) -> Result<Series, PolarsError>
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 sum<T>(&self) -> Option<T>where
T: NumCast,
pub fn sum<T>(&self) -> Option<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.
let s = Series::new("days", &[1, 2, 3]);
assert_eq!(s.sum(), Some(6));
sourcepub fn min<T>(&self) -> Option<T>where
T: NumCast,
pub fn min<T>(&self) -> 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.
let s = Series::new("days", [1, 2, 3].as_ref());
assert_eq!(s.min(), Some(1));
sourcepub fn max<T>(&self) -> Option<T>where
T: NumCast,
pub fn max<T>(&self) -> 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.
let s = Series::new("days", [1, 2, 3].as_ref());
assert_eq!(s.max(), Some(3));
sourcepub fn explode(&self) -> Result<Series, PolarsError>
pub fn explode(&self) -> Result<Series, PolarsError>
Explode a list Series. This expands every item to a new row..
sourcepub fn is_nan(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
pub fn is_nan(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
Check if float value is NaN (note this is different than missing/ null)
sourcepub fn is_not_nan(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
pub fn is_not_nan(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
Check if float value is NaN (note this is different than missing/ null)
sourcepub fn is_finite(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
pub fn is_finite(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
Check if numeric value is finite
sourcepub fn is_infinite(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
pub fn is_infinite(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
Check if float value is infinite
sourcepub fn zip_with(
&self,
mask: &ChunkedArray<BooleanType>,
other: &Series
) -> Result<Series, PolarsError>
Available on crate feature zip_with
only.
pub fn zip_with( &self, mask: &ChunkedArray<BooleanType>, other: &Series ) -> Result<Series, PolarsError>
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
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: &[u32]
) -> Result<Series, PolarsError>
pub unsafe fn take_unchecked_from_slice( &self, idx: &[u32] ) -> Result<Series, PolarsError>
Take by index if ChunkedArray contains a single chunk.
Safety
This doesn’t check any bounds. Null validity is checked.
sourcepub unsafe fn take_unchecked_threaded(
&self,
idx: &ChunkedArray<UInt32Type>,
rechunk: bool
) -> Result<Series, PolarsError>
pub unsafe fn take_unchecked_threaded( &self, idx: &ChunkedArray<UInt32Type>, rechunk: bool ) -> Result<Series, PolarsError>
Take by index if ChunkedArray contains a single chunk.
Safety
This doesn’t check any bounds. Null validity is checked.
sourcepub fn take_threaded(
&self,
idx: &ChunkedArray<UInt32Type>,
rechunk: bool
) -> Result<Series, PolarsError>
pub fn take_threaded( &self, idx: &ChunkedArray<UInt32Type>, rechunk: bool ) -> Result<Series, PolarsError>
Take by index. This operation is clone.
Notes
Out of bounds access doesn’t Error but will return a Null value
sourcepub fn filter_threaded(
&self,
filter: &ChunkedArray<BooleanType>,
rechunk: bool
) -> Result<Series, PolarsError>
pub fn filter_threaded( &self, filter: &ChunkedArray<BooleanType>, rechunk: bool ) -> Result<Series, PolarsError>
Filter by boolean mask. This operation clones data.
sourcepub fn sum_as_series(&self) -> Series
pub fn sum_as_series(&self) -> Series
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 cummax(&self, _reverse: bool) -> Series
pub fn cummax(&self, _reverse: bool) -> Series
Get an array with the cumulative max computed at every element.
sourcepub fn cummin(&self, _reverse: bool) -> Series
pub fn cummin(&self, _reverse: bool) -> Series
Get an array with the cumulative min computed at every element.
sourcepub fn cumsum(&self, reverse: bool) -> Series
pub fn cumsum(&self, reverse: bool) -> Series
Get an array with the cumulative sum computed at every element
If the DataType
is one of {Int8, UInt8, Int16, UInt16}
the Series
is
first cast to Int64
to prevent overflow issues.
sourcepub fn cumprod(&self, reverse: bool) -> Series
pub fn cumprod(&self, reverse: bool) -> Series
Get an array with the cumulative product computed at every element.
If the DataType
is one of {Int8, UInt8, Int16, UInt16, Int32, UInt32}
the Series
is
first cast to Int64
to prevent overflow issues.
sourcepub fn product(&self) -> Series
pub fn product(&self) -> Series
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.
pub fn rank(&self, options: RankOptions, seed: Option<u64>) -> Series
rank
only.sourcepub fn strict_cast(&self, dtype: &DataType) -> Result<Series, PolarsError>
pub fn strict_cast(&self, dtype: &DataType) -> Result<Series, PolarsError>
Cast throws an error if conversion had overflows
sourcepub fn abs(&self) -> Result<Series, PolarsError>
Available on crate feature abs
only.
pub fn abs(&self) -> Result<Series, PolarsError>
abs
only.convert numerical values to their absolute value
pub fn str_value(&self, index: usize) -> Result<Cow<'_, str>, PolarsError>
pub fn mean_as_series(&self) -> Series
sourcepub fn unique_stable(&self) -> Result<Series, PolarsError>
pub fn unique_stable(&self) -> Result<Series, PolarsError>
Compute the unique elements, but maintain order. This requires more work
than a naive Series::unique
.
pub fn idx(&self) -> Result<&ChunkedArray<UInt32Type>, PolarsError>
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) -> ChunkedArray<ListType>
pub fn as_list(&self) -> ChunkedArray<ListType>
Packs every element into a list.
source§impl Series
impl Series
sourcepub fn series_equal(&self, other: &Series) -> bool
pub fn series_equal(&self, other: &Series) -> bool
Check if series are equal. Note that None == None
evaluates to false
sourcepub fn series_equal_missing(&self, other: &Series) -> bool
pub fn series_equal_missing(&self, other: &Series) -> bool
Check if all values in series are equal where None == None
evaluates to true
.
Two Datetime
series are not equal if their timezones are different, regardless
if they represent the same UTC time or not.
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) -> Result<&ChunkedArray<N>, PolarsError>where N: 'static + PolarsDataType,
Trait Implementations§
source§impl AsMut<Series> for UnstableSeries<'_>
impl AsMut<Series> for UnstableSeries<'_>
source§impl AsRef<Series> for UnstableSeries<'_>
impl AsRef<Series> for UnstableSeries<'_>
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 ChunkedArray<ListType>
impl<'a> ChunkApply<'a, Series> for ChunkedArray<ListType>
source§fn apply_values<F>(&'a self, f: F) -> ChunkedArray<ListType>where
F: Fn(Series) -> Series + Copy,
fn apply_values<F>(&'a self, f: F) -> ChunkedArray<ListType>where F: Fn(Series) -> Series + Copy,
Apply a closure F
elementwise.
type FuncRet = Series
fn try_apply<F>(&'a self, f: F) -> Result<ChunkedArray<ListType>, PolarsError>where F: Fn(Series) -> Result<Series, PolarsError> + Copy,
source§impl ChunkCompare<&Series> for Series
impl ChunkCompare<&Series> for Series
source§fn equal(&self, rhs: &Series) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn equal(&self, rhs: &Series) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking for equality.
source§fn equal_missing(
&self,
rhs: &Series
) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn equal_missing( &self, rhs: &Series ) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking for equality.
source§fn not_equal(
&self,
rhs: &Series
) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn not_equal( &self, rhs: &Series ) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking for inequality.
source§fn not_equal_missing(
&self,
rhs: &Series
) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn not_equal_missing( &self, rhs: &Series ) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking for inequality.
source§fn gt(&self, rhs: &Series) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn gt(&self, rhs: &Series) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking if self > rhs.
source§fn gt_eq(&self, rhs: &Series) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn gt_eq(&self, rhs: &Series) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking if self >= rhs.
source§fn lt(&self, rhs: &Series) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn lt(&self, rhs: &Series) -> Result<ChunkedArray<BooleanType>, PolarsError>
Create a boolean mask by checking if self < rhs.
source§fn lt_eq(&self, rhs: &Series) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn lt_eq(&self, rhs: &Series) -> Result<ChunkedArray<BooleanType>, PolarsError>
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) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn equal(&self, rhs: &str) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§fn equal_missing(&self, rhs: &str) -> <Series as ChunkCompare<&str>>::Item
fn equal_missing(&self, rhs: &str) -> <Series as ChunkCompare<&str>>::Item
None == None
.source§fn not_equal(&self, rhs: &str) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn not_equal(&self, rhs: &str) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§fn not_equal_missing(&self, rhs: &str) -> <Series as ChunkCompare<&str>>::Item
fn not_equal_missing(&self, rhs: &str) -> <Series as ChunkCompare<&str>>::Item
None == None
.source§fn gt(&self, rhs: &str) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn gt(&self, rhs: &str) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§fn gt_eq(&self, rhs: &str) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn gt_eq(&self, rhs: &str) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§fn lt(&self, rhs: &str) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn lt(&self, rhs: &str) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§fn lt_eq(&self, rhs: &str) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn lt_eq(&self, rhs: &str) -> Result<ChunkedArray<BooleanType>, PolarsError>
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) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn equal(&self, rhs: Rhs) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§fn equal_missing(&self, rhs: Rhs) -> <Series as ChunkCompare<Rhs>>::Item
fn equal_missing(&self, rhs: Rhs) -> <Series as ChunkCompare<Rhs>>::Item
None == None
.source§fn not_equal(&self, rhs: Rhs) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn not_equal(&self, rhs: Rhs) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§fn not_equal_missing(&self, rhs: Rhs) -> <Series as ChunkCompare<Rhs>>::Item
fn not_equal_missing(&self, rhs: Rhs) -> <Series as ChunkCompare<Rhs>>::Item
None == None
.source§fn gt(&self, rhs: Rhs) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn gt(&self, rhs: Rhs) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§fn gt_eq(&self, rhs: Rhs) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn gt_eq(&self, rhs: Rhs) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§fn lt(&self, rhs: Rhs) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn lt(&self, rhs: Rhs) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§fn lt_eq(&self, rhs: Rhs) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn lt_eq(&self, rhs: Rhs) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§impl ChunkFull<&Series> for ChunkedArray<FixedSizeListType>
Available on crate feature dtype-array
only.
impl ChunkFull<&Series> for ChunkedArray<FixedSizeListType>
dtype-array
only.source§fn full(
name: &str,
value: &Series,
length: usize
) -> ChunkedArray<FixedSizeListType>
fn full( name: &str, value: &Series, length: usize ) -> ChunkedArray<FixedSizeListType>
source§impl ChunkQuantile<Series> for ChunkedArray<FixedSizeListType>
Available on crate feature dtype-array
only.
impl ChunkQuantile<Series> for ChunkedArray<FixedSizeListType>
dtype-array
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
) -> Result<Option<T>, PolarsError>
fn quantile( &self, _quantile: f64, _interpol: QuantileInterpolOptions ) -> Result<Option<T>, PolarsError>
None
if the array is empty or only contains null values.source§impl ChunkQuantile<Series> for ChunkedArray<ListType>
impl ChunkQuantile<Series> for ChunkedArray<ListType>
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
) -> Result<Option<T>, PolarsError>
fn quantile( &self, _quantile: f64, _interpol: QuantileInterpolOptions ) -> Result<Option<T>, PolarsError>
None
if the array is empty or only contains null values.source§impl<T> ChunkQuantile<Series> for ChunkedArray<ObjectType<T>>where
T: PolarsObject,
Available on crate feature object
only.
impl<T> ChunkQuantile<Series> for ChunkedArray<ObjectType<T>>where T: PolarsObject,
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
) -> Result<Option<T>, PolarsError>
fn quantile( &self, _quantile: f64, _interpol: QuantileInterpolOptions ) -> Result<Option<T>, PolarsError>
None
if the array is empty or only contains null values.source§impl<T> From<ChunkedArray<T>> for Serieswhere
T: PolarsDataType,
ChunkedArray<T>: IntoSeries,
impl<T> From<ChunkedArray<T>> for Serieswhere T: PolarsDataType, ChunkedArray<T>: IntoSeries,
source§fn from(ca: ChunkedArray<T>) -> Series
fn from(ca: ChunkedArray<T>) -> Series
source§impl From<Logical<DateType, Int32Type>> for Series
Available on crate feature dtype-date
only.
impl From<Logical<DateType, Int32Type>> for Series
dtype-date
only.source§impl From<Logical<DatetimeType, Int64Type>> for Series
Available on crate feature dtype-datetime
only.
impl From<Logical<DatetimeType, Int64Type>> for Series
dtype-datetime
only.source§impl From<Logical<DurationType, Int64Type>> for Series
Available on crate feature dtype-duration
only.
impl From<Logical<DurationType, Int64Type>> for Series
dtype-duration
only.source§impl From<Logical<TimeType, Int64Type>> for Series
Available on crate feature dtype-time
only.
impl From<Logical<TimeType, Int64Type>> for Series
dtype-time
only.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 i16> for Series
impl<'a> FromIterator<&'a i16> 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 i8> for Series
impl<'a> FromIterator<&'a i8> for Series
source§impl<'a> FromIterator<&'a str> for Series
impl<'a> FromIterator<&'a str> for Series
source§impl<'a> FromIterator<&'a u16> for Series
impl<'a> FromIterator<&'a u16> 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<'a> FromIterator<&'a u8> for Series
impl<'a> FromIterator<&'a u8> 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<i16> for Series
impl FromIterator<i16> 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<i8> for Series
impl FromIterator<i8> for Series
source§impl FromIterator<u16> for Series
impl FromIterator<u16> 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 FromIterator<u8> for Series
impl FromIterator<u8> for Series
source§impl IntoSeriesOps for Series
impl IntoSeriesOps for Series
source§impl<T> NamedFrom<T, [Duration]> for Serieswhere
T: AsRef<[Duration]>,
Available on crate feature dtype-duration
only.
impl<T> NamedFrom<T, [Duration]> for Serieswhere T: AsRef<[Duration]>,
dtype-duration
only.source§impl<T> NamedFrom<T, [NaiveDate]> for Serieswhere
T: AsRef<[NaiveDate]>,
Available on crate feature dtype-date
only.
impl<T> NamedFrom<T, [NaiveDate]> for Serieswhere T: AsRef<[NaiveDate]>,
dtype-date
only.source§impl<T> NamedFrom<T, [NaiveDateTime]> for Serieswhere
T: AsRef<[NaiveDateTime]>,
Available on crate feature dtype-datetime
only.
impl<T> NamedFrom<T, [NaiveDateTime]> for Serieswhere T: AsRef<[NaiveDateTime]>,
dtype-datetime
only.source§impl<T> NamedFrom<T, [NaiveTime]> for Serieswhere
T: AsRef<[NaiveTime]>,
Available on crate feature dtype-time
only.
impl<T> NamedFrom<T, [NaiveTime]> for Serieswhere T: AsRef<[NaiveTime]>,
dtype-time
only.source§impl<'a, T> NamedFrom<T, [Option<Cow<'a, [u8]>>]> for Serieswhere
T: AsRef<[Option<Cow<'a, [u8]>>]>,
impl<'a, T> NamedFrom<T, [Option<Cow<'a, [u8]>>]> for Serieswhere T: AsRef<[Option<Cow<'a, [u8]>>]>,
source§impl<'a, T> NamedFrom<T, [Option<Cow<'a, str>>]> for Serieswhere
T: AsRef<[Option<Cow<'a, str>>]>,
impl<'a, T> NamedFrom<T, [Option<Cow<'a, str>>]> for Serieswhere T: AsRef<[Option<Cow<'a, str>>]>,
source§impl<T> NamedFrom<T, [Option<Duration>]> for Serieswhere
T: AsRef<[Option<Duration>]>,
Available on crate feature dtype-duration
only.
impl<T> NamedFrom<T, [Option<Duration>]> for Serieswhere T: AsRef<[Option<Duration>]>,
dtype-duration
only.source§impl<T> NamedFrom<T, [Option<NaiveDate>]> for Serieswhere
T: AsRef<[Option<NaiveDate>]>,
Available on crate feature dtype-date
only.
impl<T> NamedFrom<T, [Option<NaiveDate>]> for Serieswhere T: AsRef<[Option<NaiveDate>]>,
dtype-date
only.source§impl<T> NamedFrom<T, [Option<NaiveDateTime>]> for Serieswhere
T: AsRef<[Option<NaiveDateTime>]>,
Available on crate feature dtype-datetime
only.
impl<T> NamedFrom<T, [Option<NaiveDateTime>]> for Serieswhere T: AsRef<[Option<NaiveDateTime>]>,
dtype-datetime
only.source§impl<T> NamedFrom<T, [Option<NaiveTime>]> for Serieswhere
T: AsRef<[Option<NaiveTime>]>,
Available on crate feature dtype-time
only.
impl<T> NamedFrom<T, [Option<NaiveTime>]> for Serieswhere T: AsRef<[Option<NaiveTime>]>,
dtype-time
only.source§impl<T> NamedFrom<T, [Option<Vec<u8, Global>>]> for Serieswhere
T: AsRef<[Option<Vec<u8, Global>>]>,
impl<T> NamedFrom<T, [Option<Vec<u8, Global>>]> for Serieswhere T: AsRef<[Option<Vec<u8, Global>>]>,
source§impl<T> NamedFrom<T, T> for Serieswhere
T: IntoSeries,
impl<T> NamedFrom<T, T> for Serieswhere T: IntoSeries,
For any ChunkedArray
and Series
source§impl NumOpsDispatchChecked for Series
impl NumOpsDispatchChecked for Series
source§fn checked_div(&self, rhs: &Series) -> Result<Series, PolarsError>
fn checked_div(&self, rhs: &Series) -> Result<Series, PolarsError>
fn checked_div_num<T>(&self, rhs: T) -> Result<Series, PolarsError>where T: ToPrimitive,
source§impl PartialEq<Series> for Series
impl PartialEq<Series> for Series
source§impl SeriesMethods for Series
impl SeriesMethods for Series
source§fn value_counts(
&self,
sort: bool,
parallel: bool
) -> Result<DataFrame, PolarsError>
fn value_counts( &self, sort: bool, parallel: bool ) -> Result<DataFrame, PolarsError>
fn is_sorted(&self, options: SortOptions) -> Result<bool, PolarsError>
source§impl SeriesOpsTime for Series
impl SeriesOpsTime for Series
source§fn rolling_quantile(
&self,
options: RollingOptionsImpl<'_>
) -> Result<Series, PolarsError>
Available on crate feature rolling_window
only.
fn rolling_quantile( &self, options: RollingOptionsImpl<'_> ) -> Result<Series, PolarsError>
rolling_window
only.Apply a rolling quantile to a Series.
source§fn rolling_max(
&self,
options: RollingOptionsImpl<'_>
) -> Result<Series, PolarsError>
Available on crate feature rolling_window
only.
fn rolling_max( &self, options: RollingOptionsImpl<'_> ) -> Result<Series, PolarsError>
rolling_window
only.Apply a rolling max to a Series.
source§fn rolling_var(
&self,
options: RollingOptionsImpl<'_>
) -> Result<Series, PolarsError>
Available on crate feature rolling_window
only.
fn rolling_var( &self, options: RollingOptionsImpl<'_> ) -> Result<Series, PolarsError>
rolling_window
only.Apply a rolling variance to a Series.
source§fn rolling_std(
&self,
options: RollingOptionsImpl<'_>
) -> Result<Series, PolarsError>
Available on crate feature rolling_window
only.
fn rolling_std( &self, options: RollingOptionsImpl<'_> ) -> Result<Series, PolarsError>
rolling_window
only.Apply a rolling std_dev to a Series.
fn ops_time_dtype(&self) -> &DataType
source§fn rolling_mean(
&self,
_options: RollingOptionsImpl<'_>
) -> Result<Series, PolarsError>
fn rolling_mean( &self, _options: RollingOptionsImpl<'_> ) -> Result<Series, PolarsError>
rolling_window
only.source§fn rolling_sum(
&self,
_options: RollingOptionsImpl<'_>
) -> Result<Series, PolarsError>
fn rolling_sum( &self, _options: RollingOptionsImpl<'_> ) -> Result<Series, PolarsError>
rolling_window
only.source§fn rolling_median(
&self,
_options: RollingOptionsImpl<'_>
) -> Result<Series, PolarsError>
fn rolling_median( &self, _options: RollingOptionsImpl<'_> ) -> Result<Series, PolarsError>
rolling_window
only.source§fn rolling_min(
&self,
options: RollingOptionsImpl<'_>
) -> Result<Series, PolarsError>
fn rolling_min( &self, options: RollingOptionsImpl<'_> ) -> Result<Series, PolarsError>
rolling_window
only.source§impl ToDummies for Series
impl ToDummies for Series
fn to_dummies( &self, separator: Option<&str>, drop_first: bool ) -> Result<DataFrame, PolarsError>
impl RollingSeries for Series
Auto Trait Implementations§
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
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> TemporalMethods for Twhere
T: AsSeries + ?Sized,
impl<T> TemporalMethods for Twhere T: AsSeries + ?Sized,
source§fn hour(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
fn hour(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
source§fn minute(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
fn minute(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
source§fn second(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
fn second(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
source§fn nanosecond(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
fn nanosecond(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
source§fn day(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
fn day(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
source§fn weekday(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
fn weekday(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
source§fn week(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
fn week(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
source§fn ordinal_day(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
fn ordinal_day(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
source§fn year(&self) -> Result<ChunkedArray<Int32Type>, PolarsError>
fn year(&self) -> Result<ChunkedArray<Int32Type>, PolarsError>
fn iso_year(&self) -> Result<ChunkedArray<Int32Type>, PolarsError>
source§fn ordinal_year(&self) -> Result<ChunkedArray<Int32Type>, PolarsError>
fn ordinal_year(&self) -> Result<ChunkedArray<Int32Type>, PolarsError>
source§fn is_leap_year(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
fn is_leap_year(&self) -> Result<ChunkedArray<BooleanType>, PolarsError>
source§fn quarter(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
fn quarter(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
source§fn month(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
fn month(&self) -> Result<ChunkedArray<UInt32Type>, PolarsError>
source§fn to_string(&self, format: &str) -> Result<Series, PolarsError>
fn to_string(&self, format: &str) -> Result<Series, PolarsError>
source§fn strftime(&self, format: &str) -> Result<Series, PolarsError>
fn strftime(&self, format: &str) -> Result<Series, PolarsError>
source§fn timestamp(
&self,
tu: TimeUnit
) -> Result<ChunkedArray<Int64Type>, PolarsError>
fn timestamp( &self, tu: TimeUnit ) -> Result<ChunkedArray<Int64Type>, PolarsError>
dtype-date
and dtype-datetime
only.TimeUnit
.