pub struct Series {
pub values: DTypeArray,
pub dtype: DType,
}
Expand description
Generic Series
§Example
extern crate peroxide;
use peroxide::fuga::*;
fn main() {
// Declare Series with Vec<T> (T: primitive type)
let a = Series::new(vec![1i32, 2, 3, 4]);
a.print(); // print for Series
a.dtype.print(); // print for dtype of Series
let b: &[i32] = a.as_slice(); // Borrow series to &[T]
let c: Vec<i32> = a.to_vec(); // Series to Vec<T> (clone)
// ...
}
Fields§
§values: DTypeArray
§dtype: DType
Implementations§
Trait Implementations§
source§impl TypedVector<String> for Series
impl TypedVector<String> for Series
fn new(v: Vec<String>) -> Self
fn to_vec(&self) -> Vec<String>
fn as_slice(&self) -> &[String]
fn as_slice_mut(&mut self) -> &mut [String]
fn at_raw(&self, i: usize) -> String
fn push(&mut self, elem: String)
fn map<F: Fn(String) -> String>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut String)>(&mut self, f: F)
fn fold<F: Fn(String, String) -> String>(&self, init: String, f: F) -> String
fn filter<F: Fn(&String) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&String) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&String) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(String, String) -> String>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<bool> for Series
impl TypedVector<bool> for Series
fn new(v: Vec<bool>) -> Self
fn to_vec(&self) -> Vec<bool>
fn as_slice(&self) -> &[bool]
fn as_slice_mut(&mut self) -> &mut [bool]
fn at_raw(&self, i: usize) -> bool
fn push(&mut self, elem: bool)
fn map<F: Fn(bool) -> bool>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut bool)>(&mut self, f: F)
fn fold<F: Fn(bool, bool) -> bool>(&self, init: bool, f: F) -> bool
fn filter<F: Fn(&bool) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&bool) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&bool) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(bool, bool) -> bool>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<char> for Series
impl TypedVector<char> for Series
fn new(v: Vec<char>) -> Self
fn to_vec(&self) -> Vec<char>
fn as_slice(&self) -> &[char]
fn as_slice_mut(&mut self) -> &mut [char]
fn at_raw(&self, i: usize) -> char
fn push(&mut self, elem: char)
fn map<F: Fn(char) -> char>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut char)>(&mut self, f: F)
fn fold<F: Fn(char, char) -> char>(&self, init: char, f: F) -> char
fn filter<F: Fn(&char) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&char) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&char) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(char, char) -> char>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<f32> for Series
impl TypedVector<f32> for Series
fn new(v: Vec<f32>) -> Self
fn to_vec(&self) -> Vec<f32>
fn as_slice(&self) -> &[f32]
fn as_slice_mut(&mut self) -> &mut [f32]
fn at_raw(&self, i: usize) -> f32
fn push(&mut self, elem: f32)
fn map<F: Fn(f32) -> f32>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut f32)>(&mut self, f: F)
fn fold<F: Fn(f32, f32) -> f32>(&self, init: f32, f: F) -> f32
fn filter<F: Fn(&f32) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&f32) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&f32) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(f32, f32) -> f32>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<f64> for Series
impl TypedVector<f64> for Series
fn new(v: Vec<f64>) -> Self
fn to_vec(&self) -> Vec<f64>
fn as_slice(&self) -> &[f64]
fn as_slice_mut(&mut self) -> &mut [f64]
fn at_raw(&self, i: usize) -> f64
fn push(&mut self, elem: f64)
fn map<F: Fn(f64) -> f64>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut f64)>(&mut self, f: F)
fn fold<F: Fn(f64, f64) -> f64>(&self, init: f64, f: F) -> f64
fn filter<F: Fn(&f64) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&f64) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&f64) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(f64, f64) -> f64>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<i16> for Series
impl TypedVector<i16> for Series
fn new(v: Vec<i16>) -> Self
fn to_vec(&self) -> Vec<i16>
fn as_slice(&self) -> &[i16]
fn as_slice_mut(&mut self) -> &mut [i16]
fn at_raw(&self, i: usize) -> i16
fn push(&mut self, elem: i16)
fn map<F: Fn(i16) -> i16>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut i16)>(&mut self, f: F)
fn fold<F: Fn(i16, i16) -> i16>(&self, init: i16, f: F) -> i16
fn filter<F: Fn(&i16) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&i16) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&i16) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(i16, i16) -> i16>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<i32> for Series
impl TypedVector<i32> for Series
fn new(v: Vec<i32>) -> Self
fn to_vec(&self) -> Vec<i32>
fn as_slice(&self) -> &[i32]
fn as_slice_mut(&mut self) -> &mut [i32]
fn at_raw(&self, i: usize) -> i32
fn push(&mut self, elem: i32)
fn map<F: Fn(i32) -> i32>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut i32)>(&mut self, f: F)
fn fold<F: Fn(i32, i32) -> i32>(&self, init: i32, f: F) -> i32
fn filter<F: Fn(&i32) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&i32) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&i32) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(i32, i32) -> i32>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<i64> for Series
impl TypedVector<i64> for Series
fn new(v: Vec<i64>) -> Self
fn to_vec(&self) -> Vec<i64>
fn as_slice(&self) -> &[i64]
fn as_slice_mut(&mut self) -> &mut [i64]
fn at_raw(&self, i: usize) -> i64
fn push(&mut self, elem: i64)
fn map<F: Fn(i64) -> i64>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut i64)>(&mut self, f: F)
fn fold<F: Fn(i64, i64) -> i64>(&self, init: i64, f: F) -> i64
fn filter<F: Fn(&i64) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&i64) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&i64) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(i64, i64) -> i64>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<i8> for Series
impl TypedVector<i8> for Series
fn new(v: Vec<i8>) -> Self
fn to_vec(&self) -> Vec<i8>
fn as_slice(&self) -> &[i8]
fn as_slice_mut(&mut self) -> &mut [i8]
fn at_raw(&self, i: usize) -> i8
fn push(&mut self, elem: i8)
fn map<F: Fn(i8) -> i8>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut i8)>(&mut self, f: F)
fn fold<F: Fn(i8, i8) -> i8>(&self, init: i8, f: F) -> i8
fn filter<F: Fn(&i8) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&i8) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&i8) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(i8, i8) -> i8>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<isize> for Series
impl TypedVector<isize> for Series
fn new(v: Vec<isize>) -> Self
fn to_vec(&self) -> Vec<isize>
fn as_slice(&self) -> &[isize]
fn as_slice_mut(&mut self) -> &mut [isize]
fn at_raw(&self, i: usize) -> isize
fn push(&mut self, elem: isize)
fn map<F: Fn(isize) -> isize>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut isize)>(&mut self, f: F)
fn fold<F: Fn(isize, isize) -> isize>(&self, init: isize, f: F) -> isize
fn filter<F: Fn(&isize) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&isize) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&isize) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(isize, isize) -> isize>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<u16> for Series
impl TypedVector<u16> for Series
fn new(v: Vec<u16>) -> Self
fn to_vec(&self) -> Vec<u16>
fn as_slice(&self) -> &[u16]
fn as_slice_mut(&mut self) -> &mut [u16]
fn at_raw(&self, i: usize) -> u16
fn push(&mut self, elem: u16)
fn map<F: Fn(u16) -> u16>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut u16)>(&mut self, f: F)
fn fold<F: Fn(u16, u16) -> u16>(&self, init: u16, f: F) -> u16
fn filter<F: Fn(&u16) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&u16) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&u16) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(u16, u16) -> u16>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<u32> for Series
impl TypedVector<u32> for Series
fn new(v: Vec<u32>) -> Self
fn to_vec(&self) -> Vec<u32>
fn as_slice(&self) -> &[u32]
fn as_slice_mut(&mut self) -> &mut [u32]
fn at_raw(&self, i: usize) -> u32
fn push(&mut self, elem: u32)
fn map<F: Fn(u32) -> u32>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut u32)>(&mut self, f: F)
fn fold<F: Fn(u32, u32) -> u32>(&self, init: u32, f: F) -> u32
fn filter<F: Fn(&u32) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&u32) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&u32) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(u32, u32) -> u32>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<u64> for Series
impl TypedVector<u64> for Series
fn new(v: Vec<u64>) -> Self
fn to_vec(&self) -> Vec<u64>
fn as_slice(&self) -> &[u64]
fn as_slice_mut(&mut self) -> &mut [u64]
fn at_raw(&self, i: usize) -> u64
fn push(&mut self, elem: u64)
fn map<F: Fn(u64) -> u64>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut u64)>(&mut self, f: F)
fn fold<F: Fn(u64, u64) -> u64>(&self, init: u64, f: F) -> u64
fn filter<F: Fn(&u64) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&u64) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&u64) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(u64, u64) -> u64>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<u8> for Series
impl TypedVector<u8> for Series
fn new(v: Vec<u8>) -> Self
fn to_vec(&self) -> Vec<u8> ⓘ
fn as_slice(&self) -> &[u8] ⓘ
fn as_slice_mut(&mut self) -> &mut [u8] ⓘ
fn at_raw(&self, i: usize) -> u8
fn push(&mut self, elem: u8)
fn map<F: Fn(u8) -> u8>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut u8)>(&mut self, f: F)
fn fold<F: Fn(u8, u8) -> u8>(&self, init: u8, f: F) -> u8
fn filter<F: Fn(&u8) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&u8) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&u8) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(u8, u8) -> u8>(&self, f: F, other: &Self) -> Self
source§impl TypedVector<usize> for Series
impl TypedVector<usize> for Series
fn new(v: Vec<usize>) -> Self
fn to_vec(&self) -> Vec<usize>
fn as_slice(&self) -> &[usize]
fn as_slice_mut(&mut self) -> &mut [usize]
fn at_raw(&self, i: usize) -> usize
fn push(&mut self, elem: usize)
fn map<F: Fn(usize) -> usize>(&self, f: F) -> Self
fn mut_map<F: Fn(&mut usize)>(&mut self, f: F)
fn fold<F: Fn(usize, usize) -> usize>(&self, init: usize, f: F) -> usize
fn filter<F: Fn(&usize) -> bool>(&self, f: F) -> Self
fn take(&self, n: usize) -> Self
fn skip(&self, n: usize) -> Self
fn take_while<F: Fn(&usize) -> bool>(&self, f: F) -> Self
fn skip_while<F: Fn(&usize) -> bool>(&self, f: F) -> Self
fn zip_with<F: Fn(usize, usize) -> usize>(&self, f: F, other: &Self) -> Self
source§impl Vector for Series
impl Vector for Series
source§fn add_vec(&self, rhs: &Self) -> Self
fn add_vec(&self, rhs: &Self) -> Self
Add series
§Example
extern crate peroxide;
use peroxide::fuga::*;
fn main() {
let a = Series::new(vec![1,2,3]);
let b = Series::new(vec![3,2,1]);
let c = a.add_vec(&b);
assert_eq!(c, Series::new(vec![4,4,4]));
}
source§fn sub_vec(&self, rhs: &Self) -> Self
fn sub_vec(&self, rhs: &Self) -> Self
Sub series
§Example
extern crate peroxide;
use peroxide::fuga::*;
fn main() {
let a = Series::new(vec![4,5,6]);
let b = Series::new(vec![1,2,3]);
let c = a.sub_vec(&b);
assert_eq!(c, Series::new(vec![3,3,3]));
}
source§fn mul_scalar(&self, rhs: Self::Scalar) -> Self
fn mul_scalar(&self, rhs: Self::Scalar) -> Self
Mul Scalar
§Example
extern crate peroxide;
use peroxide::fuga::*;
fn main() {
let a = Series::new(vec![1,2,3]);
let b = Scalar::new(2);
let c = a.mul_scalar(b);
assert_eq!(c, Series::new(vec![2,4,6]));
}
type Scalar = Scalar
impl StructuralPartialEq 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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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>
Converts
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>
Converts
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