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".into(), [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".into(), &[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 ChunkCompareEq trait and ChunkCompareIneq trait.
§Iterators
The Series variants contain differently typed ChunkedArrays. 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".into(), [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".into(), &[true, false, true]);
Series::new("int series".into(), &[1, 2, 3]);
// And can be nullable
Series::new("got nulls".into(), &[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,
) -> 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)
- 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 = Column::new("some_missing".into(), &[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>, ) -> 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
Sourcepub fn from_any_values(
name: PlSmallStr,
values: &[AnyValue<'_>],
strict: bool,
) -> Result<Series, PolarsError>
pub fn from_any_values( name: PlSmallStr, values: &[AnyValue<'_>], strict: bool, ) -> Result<Series, PolarsError>
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: PlSmallStr,
values: &[AnyValue<'_>],
dtype: &DataType,
strict: bool,
) -> Result<Series, PolarsError>
pub fn from_any_values_and_dtype( name: PlSmallStr, values: &[AnyValue<'_>], dtype: &DataType, strict: bool, ) -> Result<Series, PolarsError>
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_add_owned(self, other: Series) -> Result<Series, PolarsError>
pub fn try_sub_owned(self, other: Series) -> Result<Series, PolarsError>
pub fn try_mul_owned(self, other: Series) -> Result<Series, PolarsError>
Source§impl Series
impl Series
Sourcepub unsafe fn from_chunks_and_dtype_unchecked(
name: PlSmallStr,
chunks: Vec<Box<dyn Array>>,
dtype: &DataType,
) -> Series
pub unsafe fn from_chunks_and_dtype_unchecked( name: PlSmallStr, chunks: Vec<Box<dyn Array>>, 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.
Sourcepub unsafe fn _try_from_arrow_unchecked(
name: PlSmallStr,
chunks: Vec<Box<dyn Array>>,
dtype: &ArrowDataType,
) -> Result<Series, PolarsError>
pub unsafe fn _try_from_arrow_unchecked( name: PlSmallStr, chunks: Vec<Box<dyn Array>>, dtype: &ArrowDataType, ) -> Result<Series, PolarsError>
§Safety
The caller must ensure that the given dtype
matches all the ArrayRef
dtypes.
Sourcepub unsafe fn _try_from_arrow_unchecked_with_md(
name: PlSmallStr,
chunks: Vec<Box<dyn Array>>,
dtype: &ArrowDataType,
md: Option<&BTreeMap<PlSmallStr, PlSmallStr>>,
) -> Result<Series, PolarsError>
pub unsafe fn _try_from_arrow_unchecked_with_md( name: PlSmallStr, chunks: Vec<Box<dyn Array>>, dtype: &ArrowDataType, md: Option<&BTreeMap<PlSmallStr, PlSmallStr>>, ) -> Result<Series, PolarsError>
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
pub fn try_new<T>( name: PlSmallStr, data: T, ) -> Result<Series, <(PlSmallStr, T) as TryInto<Series>>::Error>
Source§impl Series
impl Series
Sourcepub fn array_ref(&self, chunk_idx: usize) -> &Box<dyn Array>
pub fn array_ref(&self, chunk_idx: usize) -> &Box<dyn Array>
Returns a reference to the Arrow ArrayRef
Sourcepub fn to_arrow(
&self,
chunk_idx: usize,
compat_level: CompatLevel,
) -> Box<dyn Array>
pub fn to_arrow( &self, chunk_idx: usize, compat_level: CompatLevel, ) -> Box<dyn Array>
Convert a chunk in the Series to the correct Arrow type. This conversion is needed because polars doesn’t use a 1 on 1 mapping for logical/ categoricals, etc.
Source§impl Series
impl Series
Sourcepub fn try_i8(&self) -> Option<&ChunkedArray<Int8Type>>
pub fn try_i8(&self) -> Option<&ChunkedArray<Int8Type>>
Unpack to ChunkedArray
of dtype DataType::Int8
Sourcepub fn try_i16(&self) -> Option<&ChunkedArray<Int16Type>>
pub fn try_i16(&self) -> Option<&ChunkedArray<Int16Type>>
Unpack to ChunkedArray
of dtype DataType::Int16
Sourcepub fn try_i32(&self) -> Option<&ChunkedArray<Int32Type>>
pub fn try_i32(&self) -> Option<&ChunkedArray<Int32Type>>
Unpack to ChunkedArray
let s = Series::new("foo".into(), [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 try_i64(&self) -> Option<&ChunkedArray<Int64Type>>
pub fn try_i64(&self) -> Option<&ChunkedArray<Int64Type>>
Unpack to ChunkedArray
of dtype DataType::Int64
Sourcepub fn try_f32(&self) -> Option<&ChunkedArray<Float32Type>>
pub fn try_f32(&self) -> Option<&ChunkedArray<Float32Type>>
Unpack to ChunkedArray
of dtype DataType::Float32
Sourcepub fn try_f64(&self) -> Option<&ChunkedArray<Float64Type>>
pub fn try_f64(&self) -> Option<&ChunkedArray<Float64Type>>
Unpack to ChunkedArray
of dtype DataType::Float64
Sourcepub fn try_u8(&self) -> Option<&ChunkedArray<UInt8Type>>
pub fn try_u8(&self) -> Option<&ChunkedArray<UInt8Type>>
Unpack to ChunkedArray
of dtype DataType::UInt8
Sourcepub fn try_u16(&self) -> Option<&ChunkedArray<UInt16Type>>
pub fn try_u16(&self) -> Option<&ChunkedArray<UInt16Type>>
Unpack to ChunkedArray
of dtype DataType::UInt16
Sourcepub fn try_u32(&self) -> Option<&ChunkedArray<UInt32Type>>
pub fn try_u32(&self) -> Option<&ChunkedArray<UInt32Type>>
Unpack to ChunkedArray
of dtype DataType::UInt32
Sourcepub fn try_u64(&self) -> Option<&ChunkedArray<UInt64Type>>
pub fn try_u64(&self) -> Option<&ChunkedArray<UInt64Type>>
Unpack to ChunkedArray
of dtype DataType::UInt64
Sourcepub fn try_bool(&self) -> Option<&ChunkedArray<BooleanType>>
pub fn try_bool(&self) -> Option<&ChunkedArray<BooleanType>>
Unpack to ChunkedArray
of dtype DataType::Boolean
Sourcepub fn try_str(&self) -> Option<&ChunkedArray<StringType>>
pub fn try_str(&self) -> Option<&ChunkedArray<StringType>>
Unpack to ChunkedArray
of dtype DataType::String
Sourcepub fn try_binary(&self) -> Option<&ChunkedArray<BinaryType>>
pub fn try_binary(&self) -> Option<&ChunkedArray<BinaryType>>
Unpack to ChunkedArray
of dtype DataType::Binary
Sourcepub fn try_binary_offset(&self) -> Option<&ChunkedArray<BinaryOffsetType>>
pub fn try_binary_offset(&self) -> Option<&ChunkedArray<BinaryOffsetType>>
Unpack to ChunkedArray
of dtype DataType::Binary
Sourcepub fn try_time(&self) -> Option<&Logical<TimeType, Int64Type>>
Available on crate feature dtype-time
only.
pub fn try_time(&self) -> Option<&Logical<TimeType, Int64Type>>
dtype-time
only.Unpack to ChunkedArray
of dtype DataType::Time
Sourcepub fn try_date(&self) -> Option<&Logical<DateType, Int32Type>>
Available on crate feature dtype-date
only.
pub fn try_date(&self) -> Option<&Logical<DateType, Int32Type>>
dtype-date
only.Unpack to ChunkedArray
of dtype DataType::Date
Sourcepub fn try_datetime(&self) -> Option<&Logical<DatetimeType, Int64Type>>
Available on crate feature dtype-datetime
only.
pub fn try_datetime(&self) -> Option<&Logical<DatetimeType, Int64Type>>
dtype-datetime
only.Unpack to ChunkedArray
of dtype DataType::Datetime
Sourcepub fn try_duration(&self) -> Option<&Logical<DurationType, Int64Type>>
Available on crate feature dtype-duration
only.
pub fn try_duration(&self) -> Option<&Logical<DurationType, Int64Type>>
dtype-duration
only.Unpack to ChunkedArray
of dtype DataType::Duration
Sourcepub fn try_decimal(&self) -> Option<&Logical<DecimalType, Int128Type>>
Available on crate feature dtype-decimal
only.
pub fn try_decimal(&self) -> Option<&Logical<DecimalType, Int128Type>>
dtype-decimal
only.Unpack to ChunkedArray
of dtype DataType::Decimal
Sourcepub fn try_list(&self) -> Option<&ChunkedArray<ListType>>
pub fn try_list(&self) -> Option<&ChunkedArray<ListType>>
Unpack to ChunkedArray
of dtype list
Sourcepub fn try_array(&self) -> Option<&ChunkedArray<FixedSizeListType>>
Available on crate feature dtype-array
only.
pub fn try_array(&self) -> Option<&ChunkedArray<FixedSizeListType>>
dtype-array
only.Unpack to ChunkedArray
of dtype DataType::Array
Sourcepub fn try_categorical(&self) -> Option<&CategoricalChunked>
Available on crate feature dtype-categorical
only.
pub fn try_categorical(&self) -> Option<&CategoricalChunked>
dtype-categorical
only.Unpack to ChunkedArray
of dtype DataType::Categorical
Sourcepub fn try_struct(&self) -> Option<&ChunkedArray<StructType>>
Available on crate feature dtype-struct
only.
pub fn try_struct(&self) -> Option<&ChunkedArray<StructType>>
dtype-struct
only.Unpack to ChunkedArray
of dtype DataType::Struct
Sourcepub fn try_null(&self) -> Option<&NullChunked>
pub fn try_null(&self) -> Option<&NullChunked>
Unpack to ChunkedArray
of dtype DataType::Null
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".into(), [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 str(&self) -> Result<&ChunkedArray<StringType>, PolarsError>
pub fn str(&self) -> Result<&ChunkedArray<StringType>, PolarsError>
Unpack to ChunkedArray
of dtype DataType::String
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 binary_offset(
&self,
) -> Result<&ChunkedArray<BinaryOffsetType>, PolarsError>
pub fn binary_offset( &self, ) -> Result<&ChunkedArray<BinaryOffsetType>, 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<&ChunkedArray<StructType>, PolarsError>
Available on crate feature dtype-struct
only.
pub fn struct_(&self) -> Result<&ChunkedArray<StructType>, PolarsError>
dtype-struct
only.Unpack to ChunkedArray
of dtype DataType::Struct
Sourcepub fn null(&self) -> Result<&NullChunked, PolarsError>
pub fn null(&self) -> Result<&NullChunked, PolarsError>
Unpack to ChunkedArray
of dtype DataType::Null
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 get_leaf_array(&self) -> Series
pub fn get_leaf_array(&self) -> Series
Recurse nested types until we are at the leaf array.
Sourcepub fn list_offsets_and_validities_recursive(
&self,
) -> (Vec<OffsetsBuffer<i64>>, Vec<Option<Bitmap>>)
pub fn list_offsets_and_validities_recursive( &self, ) -> (Vec<OffsetsBuffer<i64>>, Vec<Option<Bitmap>>)
TODO: Move this somewhere else?
Sourcepub fn list_rechunk_and_trim_to_normalized_offsets(&self) -> Series
pub fn list_rechunk_and_trim_to_normalized_offsets(&self) -> Series
For ListArrays, recursively normalizes the offsets to begin from 0, and slices excess length from the values array.
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_array( &self, dimensions: &[ReshapeDimension], ) -> Result<Series, PolarsError>
dtype-array
only.pub fn reshape_list( &self, dimensions: &[ReshapeDimension], ) -> Result<Series, PolarsError>
Source§impl Series
impl Series
Sourcepub fn new_empty(name: PlSmallStr, dtype: &DataType) -> Series
pub fn new_empty(name: PlSmallStr, dtype: &DataType) -> Series
Create a new empty Series.
pub fn clear(&self) -> Series
Sourcepub unsafe fn chunks_mut(&mut self) -> &mut Vec<Box<dyn Array>>
pub unsafe fn chunks_mut(&mut self) -> &mut Vec<Box<dyn Array>>
§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 into_chunks(self) -> Vec<Box<dyn Array>>
pub fn select_chunk(&self, i: usize) -> Series
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 rename(&mut self, name: PlSmallStr) -> &mut Series
pub fn rename(&mut self, name: PlSmallStr) -> &mut Series
Rename series.
Sourcepub fn with_name(self, name: PlSmallStr) -> Series
pub fn with_name(self, name: PlSmallStr) -> Series
Return this Series with a new name.
Sourcepub fn try_set_metadata<T>(&mut self, metadata: Metadata<T>) -> boolwhere
T: PolarsDataType + 'static,
pub fn try_set_metadata<T>(&mut self, metadata: Metadata<T>) -> boolwhere
T: PolarsDataType + 'static,
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: PlSmallStr, arrays: Vec<Box<dyn Array>>, ) -> Result<Series, PolarsError>
pub fn from_arrow( name: PlSmallStr, array: Box<dyn Array>, ) -> Result<Series, PolarsError>
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 compute_len(&mut self)
pub fn compute_len(&mut self)
Redo a length and null_count compute
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
.
Sourcepub fn sort(&self, sort_options: SortOptions) -> Result<Series, PolarsError>
pub fn sort(&self, sort_options: SortOptions) -> Result<Series, PolarsError>
Sort the series with specific options.
§Example
let s = Series::new("foo".into(), [2, 1, 3]);
let sorted = s.sort(SortOptions::default())?;
assert_eq!(sorted, Series::new("foo".into(), [1, 2, 3]));
}
See SortOptions
for more options.
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
pub fn cast(&self, dtype: &DataType) -> Result<Series, PolarsError>
Sourcepub fn cast_with_options(
&self,
dtype: &DataType,
options: CastOptions,
) -> Result<Series, PolarsError>
pub fn cast_with_options( &self, dtype: &DataType, options: CastOptions, ) -> Result<Series, PolarsError>
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 to_float(&self) -> Result<Series, PolarsError>
pub fn to_float(&self) -> Result<Series, PolarsError>
Cast numerical types to f64, and keep floats as is.
Sourcepub fn sum<T>(&self) -> Result<T, PolarsError>where
T: NumCast,
pub fn sum<T>(&self) -> Result<T, PolarsError>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) -> Result<Option<T>, PolarsError>where
T: NumCast,
pub fn min<T>(&self) -> Result<Option<T>, PolarsError>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) -> Result<Option<T>, PolarsError>where
T: NumCast,
pub fn max<T>(&self) -> Result<Option<T>, PolarsError>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) -> 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
. This function automatically broadcasts unit
length inputs.
Sourcepub fn to_physical_repr(&self) -> Cow<'_, Series>
pub fn to_physical_repr(&self) -> Cow<'_, Series>
Converts a Series to their physical representation, if they have one, otherwise the series is left unchanged.
- Date -> Int32
- Datetime -> Int64
- Duration -> Int64
- Time -> Int64
- Categorical -> UInt32
- List(inner) -> List(physical of inner)
- Array(inner) -> Array(physical of inner)
- Struct -> Struct with physical repr of each struct column
Sourcepub unsafe fn to_logical_repr_unchecked(
&self,
dtype: &DataType,
) -> Result<Series, PolarsError>
pub unsafe fn to_logical_repr_unchecked( &self, dtype: &DataType, ) -> Result<Series, PolarsError>
Attempts to convert a Series to dtype, only allowing conversions from physical to logical dtypes–the inverse of to_physical_repr().
§Safety
When converting from UInt32 to Categorical it is not checked that the values are in-bound for the categorical mapping.
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.
Sourcepub fn sum_reduce(&self) -> Result<Scalar, PolarsError>
pub fn sum_reduce(&self) -> Result<Scalar, PolarsError>
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) -> Result<Scalar, PolarsError>
pub fn product(&self) -> Result<Scalar, PolarsError>
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) -> Result<Series, PolarsError>
pub fn strict_cast(&self, dtype: &DataType) -> Result<Series, PolarsError>
Cast throws an error if conversion had overflows
pub fn str_value(&self, index: usize) -> Result<Cow<'_, str>, PolarsError>
pub fn mean_reduce(&self) -> Scalar
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 try_idx(&self) -> Option<&ChunkedArray<UInt32Type>>
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.
Methods from Deref<Target = dyn SeriesTrait>§
pub fn unpack<N>(&self) -> Result<&ChunkedArray<N>, PolarsError>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 ChunkedArray<ListType>
impl<'a> ChunkApply<'a, Series> for ChunkedArray<ListType>
Source§fn apply_values<F>(&'a self, f: F) -> ChunkedArray<ListType>
fn apply_values<F>(&'a self, f: F) -> ChunkedArray<ListType>
Apply a closure F
elementwise.
type FuncRet = Series
Source§fn apply<F>(&'a self, f: F) -> ChunkedArray<ListType>
fn apply<F>(&'a self, f: F) -> ChunkedArray<ListType>
Source§impl ChunkCompareEq<&Series> for Series
impl ChunkCompareEq<&Series> for Series
Source§fn equal(&self, rhs: &Series) -> <Series as ChunkCompareEq<&Series>>::Item
fn equal(&self, rhs: &Series) -> <Series as ChunkCompareEq<&Series>>::Item
Create a boolean mask by checking for equality.
Source§fn equal_missing(
&self,
rhs: &Series,
) -> <Series as ChunkCompareEq<&Series>>::Item
fn equal_missing( &self, rhs: &Series, ) -> <Series as ChunkCompareEq<&Series>>::Item
Create a boolean mask by checking for equality.
Source§fn not_equal(&self, rhs: &Series) -> <Series as ChunkCompareEq<&Series>>::Item
fn not_equal(&self, rhs: &Series) -> <Series as ChunkCompareEq<&Series>>::Item
Create a boolean mask by checking for inequality.
Source§fn not_equal_missing(
&self,
rhs: &Series,
) -> <Series as ChunkCompareEq<&Series>>::Item
fn not_equal_missing( &self, rhs: &Series, ) -> <Series as ChunkCompareEq<&Series>>::Item
Create a boolean mask by checking for inequality.
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§impl ChunkCompareEq<&str> for Series
impl ChunkCompareEq<&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 ChunkCompareEq<&str>>::Item
fn equal_missing(&self, rhs: &str) -> <Series as ChunkCompareEq<&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 ChunkCompareEq<&str>>::Item
fn not_equal_missing(&self, rhs: &str) -> <Series as ChunkCompareEq<&str>>::Item
None == None
.Source§impl<Rhs> ChunkCompareEq<Rhs> for Serieswhere
Rhs: NumericNative,
impl<Rhs> ChunkCompareEq<Rhs> for Serieswhere
Rhs: NumericNative,
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§fn equal_missing(&self, rhs: Rhs) -> <Series as ChunkCompareEq<Rhs>>::Item
fn equal_missing(&self, rhs: Rhs) -> <Series as ChunkCompareEq<Rhs>>::Item
None == None
.Source§fn not_equal_missing(&self, rhs: Rhs) -> <Series as ChunkCompareEq<Rhs>>::Item
fn not_equal_missing(&self, rhs: Rhs) -> <Series as ChunkCompareEq<Rhs>>::Item
None == None
.Source§impl ChunkCompareIneq<&Series> for Series
impl ChunkCompareIneq<&Series> for Series
Source§fn gt(&self, rhs: &Series) -> <Series as ChunkCompareIneq<&Series>>::Item
fn gt(&self, rhs: &Series) -> <Series as ChunkCompareIneq<&Series>>::Item
Create a boolean mask by checking if self > rhs.
Source§fn gt_eq(&self, rhs: &Series) -> <Series as ChunkCompareIneq<&Series>>::Item
fn gt_eq(&self, rhs: &Series) -> <Series as ChunkCompareIneq<&Series>>::Item
Create a boolean mask by checking if self >= rhs.
Source§fn lt(&self, rhs: &Series) -> <Series as ChunkCompareIneq<&Series>>::Item
fn lt(&self, rhs: &Series) -> <Series as ChunkCompareIneq<&Series>>::Item
Create a boolean mask by checking if self < rhs.
Source§fn lt_eq(&self, rhs: &Series) -> <Series as ChunkCompareIneq<&Series>>::Item
fn lt_eq(&self, rhs: &Series) -> <Series as ChunkCompareIneq<&Series>>::Item
Create a boolean mask by checking if self <= rhs.
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§impl ChunkCompareIneq<&str> for Series
impl ChunkCompareIneq<&str> for Series
type Item = Result<ChunkedArray<BooleanType>, PolarsError>
Source§impl<Rhs> ChunkCompareIneq<Rhs> for Serieswhere
Rhs: NumericNative,
impl<Rhs> ChunkCompareIneq<Rhs> for Serieswhere
Rhs: NumericNative,
type Item = 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: PlSmallStr,
value: &Series,
length: usize,
) -> ChunkedArray<FixedSizeListType>
fn full( name: PlSmallStr, value: &Series, length: usize, ) -> ChunkedArray<FixedSizeListType>
Source§impl ChunkFull<&Series> for ChunkedArray<ListType>
impl ChunkFull<&Series> for ChunkedArray<ListType>
Source§fn full(
name: PlSmallStr,
value: &Series,
length: usize,
) -> ChunkedArray<ListType>
fn full( name: PlSmallStr, value: &Series, length: usize, ) -> ChunkedArray<ListType>
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,
_method: QuantileMethod,
) -> Result<Option<T>, PolarsError>
fn quantile( &self, _quantile: f64, _method: QuantileMethod, ) -> 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,
_method: QuantileMethod,
) -> Result<Option<T>, PolarsError>
fn quantile( &self, _quantile: f64, _method: QuantileMethod, ) -> 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,
_method: QuantileMethod,
) -> Result<Option<T>, PolarsError>
fn quantile( &self, _quantile: f64, _method: QuantileMethod, ) -> Result<Option<T>, PolarsError>
None
if the array is empty or only contains null values.Source§impl<'de> Deserialize<'de> for Series
impl<'de> Deserialize<'de> for Series
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Series, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Series, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl<T> From<ChunkedArray<T>> for Series
impl<T> From<ChunkedArray<T>> for Series
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<'a, T> NamedFrom<T, [&'a [u8]]> for Series
impl<'a, T> NamedFrom<T, [&'a [u8]]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<'a, T> NamedFrom<T, [&'a str]> for Series
impl<'a, T> NamedFrom<T, [&'a str]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<'a, T> NamedFrom<T, [AnyValue<'a>]> for Series
impl<'a, T> NamedFrom<T, [AnyValue<'a>]> for Series
Source§fn new(name: PlSmallStr, values: T) -> Series
fn new(name: PlSmallStr, values: T) -> Series
Construct a new Series
from a collection of AnyValue
.
§Panics
Panics if the values do not all share the same data type (with the exception
of DataType::Null
, which is always allowed).
Source§impl<'a, T> NamedFrom<T, [Cow<'a, [u8]>]> for Series
impl<'a, T> NamedFrom<T, [Cow<'a, [u8]>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<'a, T> NamedFrom<T, [Cow<'a, str>]> for Series
impl<'a, T> NamedFrom<T, [Cow<'a, str>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [NaiveDate]> for Series
Available on crate feature dtype-date
only.
impl<T> NamedFrom<T, [NaiveDate]> for Series
dtype-date
only.Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
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§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [NaiveTime]> for Series
Available on crate feature dtype-time
only.
impl<T> NamedFrom<T, [NaiveTime]> for Series
dtype-time
only.Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<'a, T> NamedFrom<T, [Option<&'a [u8]>]> for Series
impl<'a, T> NamedFrom<T, [Option<&'a [u8]>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<'a, T> NamedFrom<T, [Option<&'a str>]> for Series
impl<'a, T> NamedFrom<T, [Option<&'a str>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<'a, T> NamedFrom<T, [Option<Cow<'a, [u8]>>]> for Series
impl<'a, T> NamedFrom<T, [Option<Cow<'a, [u8]>>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<'a, T> NamedFrom<T, [Option<Cow<'a, str>>]> for Series
impl<'a, T> NamedFrom<T, [Option<Cow<'a, str>>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<NaiveDate>]> for Series
Available on crate feature dtype-date
only.
impl<T> NamedFrom<T, [Option<NaiveDate>]> for Series
dtype-date
only.Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<NaiveDateTime>]> for Series
Available on crate feature dtype-datetime
only.
impl<T> NamedFrom<T, [Option<NaiveDateTime>]> for Series
dtype-datetime
only.Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<NaiveTime>]> for Series
Available on crate feature dtype-time
only.
impl<T> NamedFrom<T, [Option<NaiveTime>]> for Series
dtype-time
only.Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<Series>]> for Series
impl<T> NamedFrom<T, [Option<Series>]> for Series
Source§fn new(name: PlSmallStr, s: T) -> Series
fn new(name: PlSmallStr, s: T) -> Series
Source§impl<T> NamedFrom<T, [Option<String>]> for Series
impl<T> NamedFrom<T, [Option<String>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<TimeDelta>]> for Series
Available on crate feature dtype-duration
only.
impl<T> NamedFrom<T, [Option<TimeDelta>]> for Series
dtype-duration
only.Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<Vec<u8>>]> for Series
impl<T> NamedFrom<T, [Option<Vec<u8>>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<bool>]> for Series
impl<T> NamedFrom<T, [Option<bool>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<f32>]> for Series
impl<T> NamedFrom<T, [Option<f32>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<f64>]> for Series
impl<T> NamedFrom<T, [Option<f64>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<i128>]> for Series
impl<T> NamedFrom<T, [Option<i128>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<i16>]> for Series
impl<T> NamedFrom<T, [Option<i16>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<i32>]> for Series
impl<T> NamedFrom<T, [Option<i32>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<i64>]> for Series
impl<T> NamedFrom<T, [Option<i64>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<i8>]> for Series
impl<T> NamedFrom<T, [Option<i8>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<u16>]> for Series
impl<T> NamedFrom<T, [Option<u16>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<u32>]> for Series
impl<T> NamedFrom<T, [Option<u32>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<u64>]> for Series
impl<T> NamedFrom<T, [Option<u64>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Option<u8>]> for Series
impl<T> NamedFrom<T, [Option<u8>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [String]> for Series
impl<T> NamedFrom<T, [String]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [TimeDelta]> for Series
Available on crate feature dtype-duration
only.
impl<T> NamedFrom<T, [TimeDelta]> for Series
dtype-duration
only.Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [Vec<u8>]> for Series
impl<T> NamedFrom<T, [Vec<u8>]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [bool]> for Series
impl<T> NamedFrom<T, [bool]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [f32]> for Series
impl<T> NamedFrom<T, [f32]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [f64]> for Series
impl<T> NamedFrom<T, [f64]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [i128]> for Series
impl<T> NamedFrom<T, [i128]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [i16]> for Series
impl<T> NamedFrom<T, [i16]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [i32]> for Series
impl<T> NamedFrom<T, [i32]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [i64]> for Series
impl<T> NamedFrom<T, [i64]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [i8]> for Series
impl<T> NamedFrom<T, [i8]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [u16]> for Series
impl<T> NamedFrom<T, [u16]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [u32]> for Series
impl<T> NamedFrom<T, [u32]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [u64]> for Series
impl<T> NamedFrom<T, [u64]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, [u8]> for Series
impl<T> NamedFrom<T, [u8]> for Series
Source§fn new(name: PlSmallStr, v: T) -> Series
fn new(name: PlSmallStr, v: T) -> Series
Source§impl<T> NamedFrom<T, ListType> for Series
impl<T> NamedFrom<T, ListType> for Series
Source§fn new(name: PlSmallStr, s: T) -> Series
fn new(name: PlSmallStr, s: T) -> Series
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§fn new(name: PlSmallStr, t: T) -> Series
fn new(name: PlSmallStr, t: T) -> 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 RoundSeries for Series
impl RoundSeries for Series
Source§fn round(&self, decimals: u32) -> Result<Series, PolarsError>
fn round(&self, decimals: u32) -> Result<Series, PolarsError>
fn round_sig_figs(&self, digits: i32) -> Result<Series, PolarsError>
Source§impl Serialize for Series
impl Serialize for Series
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl SeriesJoin for Series
impl SeriesJoin for Series
Source§fn hash_join_semi_anti(
&self,
other: &Series,
anti: bool,
join_nulls: bool,
) -> Result<Vec<u32>, PolarsError>
fn hash_join_semi_anti( &self, other: &Series, anti: bool, join_nulls: bool, ) -> Result<Vec<u32>, PolarsError>
semi_anti_join
only.fn hash_join_inner( &self, other: &Series, validate: JoinValidation, join_nulls: bool, ) -> Result<((Vec<u32>, Vec<u32>), bool), PolarsError>
fn hash_join_outer( &self, other: &Series, validate: JoinValidation, join_nulls: bool, ) -> Result<(PrimitiveArray<u32>, PrimitiveArray<u32>), PolarsError>
Source§impl SeriesMethods for Series
impl SeriesMethods for Series
Source§fn value_counts(
&self,
sort: bool,
parallel: bool,
name: PlSmallStr,
normalize: bool,
) -> Result<DataFrame, PolarsError>
fn value_counts( &self, sort: bool, parallel: bool, name: PlSmallStr, normalize: bool, ) -> Result<DataFrame, PolarsError>
fn ensure_sorted_arg(&self, operation: &str) -> Result<(), PolarsError>
Source§fn is_sorted(&self, options: SortOptions) -> Result<bool, PolarsError>
fn is_sorted(&self, options: SortOptions) -> Result<bool, PolarsError>
Series
is sorted. Tries to fail fast.Source§impl SeriesOpsTime for Series
impl SeriesOpsTime for Series
Source§fn rolling_mean_by(
&self,
by: &Series,
options: RollingOptionsDynamicWindow,
) -> Result<Series, PolarsError>
fn rolling_mean_by( &self, by: &Series, options: RollingOptionsDynamicWindow, ) -> Result<Series, PolarsError>
rolling_window_by
only.Source§fn rolling_mean(
&self,
options: RollingOptionsFixedWindow,
) -> Result<Series, PolarsError>
fn rolling_mean( &self, options: RollingOptionsFixedWindow, ) -> Result<Series, PolarsError>
rolling_window
only.Source§fn rolling_sum_by(
&self,
by: &Series,
options: RollingOptionsDynamicWindow,
) -> Result<Series, PolarsError>
fn rolling_sum_by( &self, by: &Series, options: RollingOptionsDynamicWindow, ) -> Result<Series, PolarsError>
rolling_window_by
only.Source§fn rolling_sum(
&self,
options: RollingOptionsFixedWindow,
) -> Result<Series, PolarsError>
fn rolling_sum( &self, options: RollingOptionsFixedWindow, ) -> Result<Series, PolarsError>
rolling_window
only.Source§fn rolling_quantile_by(
&self,
by: &Series,
options: RollingOptionsDynamicWindow,
) -> Result<Series, PolarsError>
fn rolling_quantile_by( &self, by: &Series, options: RollingOptionsDynamicWindow, ) -> Result<Series, PolarsError>
rolling_window_by
only.Source§fn rolling_quantile(
&self,
options: RollingOptionsFixedWindow,
) -> Result<Series, PolarsError>
fn rolling_quantile( &self, options: RollingOptionsFixedWindow, ) -> Result<Series, PolarsError>
rolling_window
only.Source§fn rolling_min_by(
&self,
by: &Series,
options: RollingOptionsDynamicWindow,
) -> Result<Series, PolarsError>
fn rolling_min_by( &self, by: &Series, options: RollingOptionsDynamicWindow, ) -> Result<Series, PolarsError>
rolling_window_by
only.Source§fn rolling_min(
&self,
options: RollingOptionsFixedWindow,
) -> Result<Series, PolarsError>
fn rolling_min( &self, options: RollingOptionsFixedWindow, ) -> Result<Series, PolarsError>
rolling_window
only.Source§fn rolling_max_by(
&self,
by: &Series,
options: RollingOptionsDynamicWindow,
) -> Result<Series, PolarsError>
fn rolling_max_by( &self, by: &Series, options: RollingOptionsDynamicWindow, ) -> Result<Series, PolarsError>
rolling_window_by
only.Source§fn rolling_max(
&self,
options: RollingOptionsFixedWindow,
) -> Result<Series, PolarsError>
fn rolling_max( &self, options: RollingOptionsFixedWindow, ) -> Result<Series, PolarsError>
rolling_window
only.Source§fn rolling_var_by(
&self,
by: &Series,
options: RollingOptionsDynamicWindow,
) -> Result<Series, PolarsError>
fn rolling_var_by( &self, by: &Series, options: RollingOptionsDynamicWindow, ) -> Result<Series, PolarsError>
rolling_window_by
only.Source§fn rolling_var(
&self,
options: RollingOptionsFixedWindow,
) -> Result<Series, PolarsError>
fn rolling_var( &self, options: RollingOptionsFixedWindow, ) -> Result<Series, PolarsError>
rolling_window
only.Source§fn rolling_std_by(
&self,
by: &Series,
options: RollingOptionsDynamicWindow,
) -> Result<Series, PolarsError>
fn rolling_std_by( &self, by: &Series, options: RollingOptionsDynamicWindow, ) -> Result<Series, PolarsError>
rolling_window_by
only.Source§fn rolling_std(
&self,
options: RollingOptionsFixedWindow,
) -> Result<Series, PolarsError>
fn rolling_std( &self, options: RollingOptionsFixedWindow, ) -> Result<Series, PolarsError>
rolling_window
only.Source§impl SeriesRank for Series
impl SeriesRank for Series
Source§impl TakeChunked for Series
impl TakeChunked for Series
Source§impl ToDummies for Series
impl ToDummies for Series
fn to_dummies( &self, separator: Option<&str>, drop_first: bool, ) -> Result<DataFrame, PolarsError>
Source§impl TryFrom<(PlSmallStr, Box<dyn Array>)> for Series
impl TryFrom<(PlSmallStr, Box<dyn Array>)> for Series
Source§type Error = PolarsError
type Error = PolarsError
Source§fn try_from(
name_arr: (PlSmallStr, Box<dyn Array>),
) -> Result<Series, PolarsError>
fn try_from( name_arr: (PlSmallStr, Box<dyn Array>), ) -> Result<Series, PolarsError>
Source§impl TryFrom<(PlSmallStr, Vec<Box<dyn Array>>)> for Series
impl TryFrom<(PlSmallStr, Vec<Box<dyn Array>>)> for Series
Source§type Error = PolarsError
type Error = PolarsError
Source§fn try_from(
name_arr: (PlSmallStr, Vec<Box<dyn Array>>),
) -> Result<Series, PolarsError>
fn try_from( name_arr: (PlSmallStr, Vec<Box<dyn Array>>), ) -> Result<Series, PolarsError>
impl RollingSeries for Series
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoColumn for Twhere
T: IntoSeries,
impl<T> IntoColumn for Twhere
T: IntoSeries,
fn into_column(self) -> Column
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§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> TemporalMethods for T
impl<T> TemporalMethods for T
Source§fn hour(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
fn hour(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
Source§fn minute(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
fn minute(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
Source§fn second(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
fn second(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
Source§fn nanosecond(&self) -> Result<ChunkedArray<Int32Type>, PolarsError>
fn nanosecond(&self) -> Result<ChunkedArray<Int32Type>, PolarsError>
Source§fn day(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
fn day(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
Source§fn weekday(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
fn weekday(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
Source§fn week(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
fn week(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
Source§fn ordinal_day(&self) -> Result<ChunkedArray<Int16Type>, PolarsError>
fn ordinal_day(&self) -> Result<ChunkedArray<Int16Type>, PolarsError>
Source§fn millennium(&self) -> Result<ChunkedArray<Int32Type>, PolarsError>
fn millennium(&self) -> Result<ChunkedArray<Int32Type>, PolarsError>
Source§fn century(&self) -> Result<ChunkedArray<Int32Type>, PolarsError>
fn century(&self) -> Result<ChunkedArray<Int32Type>, 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<Int8Type>, PolarsError>
fn quarter(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
Source§fn month(&self) -> Result<ChunkedArray<Int8Type>, PolarsError>
fn month(&self) -> Result<ChunkedArray<Int8Type>, 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>
temporal
only.TimeUnit
.§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()
] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
]. Read more