Struct peroxide::structure::dataframe::Series

source ·
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§

source§

impl Series

source

pub fn at(&self, i: usize) -> Scalar

Getter for Series

§Examples
extern crate peroxide;
use peroxide::fuga::*;

fn main() {
    let a = Series::new(vec![1i32,2,3,4]);
    let x = a.at(0);

    assert_eq!(x, Scalar::new(1i32));
}
source

pub fn len(&self) -> usize

Length for Series

source

pub fn to_type(&self, dtype: DType) -> Series

Explicit type casting for Series

source

pub fn as_type(&mut self, dtype: DType)

Type casting for Series

§Examples
extern crate peroxide;
use peroxide::fuga::*;

fn main() {
    let mut a = Series::new(vec![1i32, 2, 3, 4]);
    a.as_type(USIZE);
     
    assert_eq!(a, Series::new(vec![1usize, 2, 3, 4]));
}

Trait Implementations§

source§

impl Clone for Series

source§

fn clone(&self) -> Series

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Series

source§

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

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

impl PartialEq for Series

source§

fn eq(&self, other: &Series) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Printable for Series

source§

fn print(&self)

source§

impl TypedVector<String> for Series

source§

fn new(v: Vec<String>) -> Self

source§

fn to_vec(&self) -> Vec<String>

source§

fn as_slice(&self) -> &[String]

source§

fn as_slice_mut(&mut self) -> &mut [String]

source§

fn at_raw(&self, i: usize) -> String

source§

fn push(&mut self, elem: String)

source§

fn map<F: Fn(String) -> String>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut String)>(&mut self, f: F)

source§

fn fold<F: Fn(String, String) -> String>(&self, init: String, f: F) -> String

source§

fn filter<F: Fn(&String) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&String) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&String) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(String, String) -> String>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<bool> for Series

source§

fn new(v: Vec<bool>) -> Self

source§

fn to_vec(&self) -> Vec<bool>

source§

fn as_slice(&self) -> &[bool]

source§

fn as_slice_mut(&mut self) -> &mut [bool]

source§

fn at_raw(&self, i: usize) -> bool

source§

fn push(&mut self, elem: bool)

source§

fn map<F: Fn(bool) -> bool>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut bool)>(&mut self, f: F)

source§

fn fold<F: Fn(bool, bool) -> bool>(&self, init: bool, f: F) -> bool

source§

fn filter<F: Fn(&bool) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&bool) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&bool) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(bool, bool) -> bool>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<char> for Series

source§

fn new(v: Vec<char>) -> Self

source§

fn to_vec(&self) -> Vec<char>

source§

fn as_slice(&self) -> &[char]

source§

fn as_slice_mut(&mut self) -> &mut [char]

source§

fn at_raw(&self, i: usize) -> char

source§

fn push(&mut self, elem: char)

source§

fn map<F: Fn(char) -> char>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut char)>(&mut self, f: F)

source§

fn fold<F: Fn(char, char) -> char>(&self, init: char, f: F) -> char

source§

fn filter<F: Fn(&char) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&char) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&char) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(char, char) -> char>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<f32> for Series

source§

fn new(v: Vec<f32>) -> Self

source§

fn to_vec(&self) -> Vec<f32>

source§

fn as_slice(&self) -> &[f32]

source§

fn as_slice_mut(&mut self) -> &mut [f32]

source§

fn at_raw(&self, i: usize) -> f32

source§

fn push(&mut self, elem: f32)

source§

fn map<F: Fn(f32) -> f32>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut f32)>(&mut self, f: F)

source§

fn fold<F: Fn(f32, f32) -> f32>(&self, init: f32, f: F) -> f32

source§

fn filter<F: Fn(&f32) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&f32) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&f32) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(f32, f32) -> f32>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<f64> for Series

source§

fn new(v: Vec<f64>) -> Self

source§

fn to_vec(&self) -> Vec<f64>

source§

fn as_slice(&self) -> &[f64]

source§

fn as_slice_mut(&mut self) -> &mut [f64]

source§

fn at_raw(&self, i: usize) -> f64

source§

fn push(&mut self, elem: f64)

source§

fn map<F: Fn(f64) -> f64>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut f64)>(&mut self, f: F)

source§

fn fold<F: Fn(f64, f64) -> f64>(&self, init: f64, f: F) -> f64

source§

fn filter<F: Fn(&f64) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&f64) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&f64) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(f64, f64) -> f64>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<i16> for Series

source§

fn new(v: Vec<i16>) -> Self

source§

fn to_vec(&self) -> Vec<i16>

source§

fn as_slice(&self) -> &[i16]

source§

fn as_slice_mut(&mut self) -> &mut [i16]

source§

fn at_raw(&self, i: usize) -> i16

source§

fn push(&mut self, elem: i16)

source§

fn map<F: Fn(i16) -> i16>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut i16)>(&mut self, f: F)

source§

fn fold<F: Fn(i16, i16) -> i16>(&self, init: i16, f: F) -> i16

source§

fn filter<F: Fn(&i16) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&i16) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&i16) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(i16, i16) -> i16>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<i32> for Series

source§

fn new(v: Vec<i32>) -> Self

source§

fn to_vec(&self) -> Vec<i32>

source§

fn as_slice(&self) -> &[i32]

source§

fn as_slice_mut(&mut self) -> &mut [i32]

source§

fn at_raw(&self, i: usize) -> i32

source§

fn push(&mut self, elem: i32)

source§

fn map<F: Fn(i32) -> i32>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut i32)>(&mut self, f: F)

source§

fn fold<F: Fn(i32, i32) -> i32>(&self, init: i32, f: F) -> i32

source§

fn filter<F: Fn(&i32) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&i32) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&i32) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(i32, i32) -> i32>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<i64> for Series

source§

fn new(v: Vec<i64>) -> Self

source§

fn to_vec(&self) -> Vec<i64>

source§

fn as_slice(&self) -> &[i64]

source§

fn as_slice_mut(&mut self) -> &mut [i64]

source§

fn at_raw(&self, i: usize) -> i64

source§

fn push(&mut self, elem: i64)

source§

fn map<F: Fn(i64) -> i64>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut i64)>(&mut self, f: F)

source§

fn fold<F: Fn(i64, i64) -> i64>(&self, init: i64, f: F) -> i64

source§

fn filter<F: Fn(&i64) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&i64) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&i64) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(i64, i64) -> i64>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<i8> for Series

source§

fn new(v: Vec<i8>) -> Self

source§

fn to_vec(&self) -> Vec<i8>

source§

fn as_slice(&self) -> &[i8]

source§

fn as_slice_mut(&mut self) -> &mut [i8]

source§

fn at_raw(&self, i: usize) -> i8

source§

fn push(&mut self, elem: i8)

source§

fn map<F: Fn(i8) -> i8>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut i8)>(&mut self, f: F)

source§

fn fold<F: Fn(i8, i8) -> i8>(&self, init: i8, f: F) -> i8

source§

fn filter<F: Fn(&i8) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&i8) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&i8) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(i8, i8) -> i8>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<isize> for Series

source§

fn new(v: Vec<isize>) -> Self

source§

fn to_vec(&self) -> Vec<isize>

source§

fn as_slice(&self) -> &[isize]

source§

fn as_slice_mut(&mut self) -> &mut [isize]

source§

fn at_raw(&self, i: usize) -> isize

source§

fn push(&mut self, elem: isize)

source§

fn map<F: Fn(isize) -> isize>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut isize)>(&mut self, f: F)

source§

fn fold<F: Fn(isize, isize) -> isize>(&self, init: isize, f: F) -> isize

source§

fn filter<F: Fn(&isize) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&isize) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&isize) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(isize, isize) -> isize>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<u16> for Series

source§

fn new(v: Vec<u16>) -> Self

source§

fn to_vec(&self) -> Vec<u16>

source§

fn as_slice(&self) -> &[u16]

source§

fn as_slice_mut(&mut self) -> &mut [u16]

source§

fn at_raw(&self, i: usize) -> u16

source§

fn push(&mut self, elem: u16)

source§

fn map<F: Fn(u16) -> u16>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut u16)>(&mut self, f: F)

source§

fn fold<F: Fn(u16, u16) -> u16>(&self, init: u16, f: F) -> u16

source§

fn filter<F: Fn(&u16) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&u16) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&u16) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(u16, u16) -> u16>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<u32> for Series

source§

fn new(v: Vec<u32>) -> Self

source§

fn to_vec(&self) -> Vec<u32>

source§

fn as_slice(&self) -> &[u32]

source§

fn as_slice_mut(&mut self) -> &mut [u32]

source§

fn at_raw(&self, i: usize) -> u32

source§

fn push(&mut self, elem: u32)

source§

fn map<F: Fn(u32) -> u32>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut u32)>(&mut self, f: F)

source§

fn fold<F: Fn(u32, u32) -> u32>(&self, init: u32, f: F) -> u32

source§

fn filter<F: Fn(&u32) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&u32) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&u32) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(u32, u32) -> u32>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<u64> for Series

source§

fn new(v: Vec<u64>) -> Self

source§

fn to_vec(&self) -> Vec<u64>

source§

fn as_slice(&self) -> &[u64]

source§

fn as_slice_mut(&mut self) -> &mut [u64]

source§

fn at_raw(&self, i: usize) -> u64

source§

fn push(&mut self, elem: u64)

source§

fn map<F: Fn(u64) -> u64>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut u64)>(&mut self, f: F)

source§

fn fold<F: Fn(u64, u64) -> u64>(&self, init: u64, f: F) -> u64

source§

fn filter<F: Fn(&u64) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&u64) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&u64) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(u64, u64) -> u64>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<u8> for Series

source§

fn new(v: Vec<u8>) -> Self

source§

fn to_vec(&self) -> Vec<u8>

source§

fn as_slice(&self) -> &[u8]

source§

fn as_slice_mut(&mut self) -> &mut [u8]

source§

fn at_raw(&self, i: usize) -> u8

source§

fn push(&mut self, elem: u8)

source§

fn map<F: Fn(u8) -> u8>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut u8)>(&mut self, f: F)

source§

fn fold<F: Fn(u8, u8) -> u8>(&self, init: u8, f: F) -> u8

source§

fn filter<F: Fn(&u8) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&u8) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&u8) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(u8, u8) -> u8>(&self, f: F, other: &Self) -> Self

source§

impl TypedVector<usize> for Series

source§

fn new(v: Vec<usize>) -> Self

source§

fn to_vec(&self) -> Vec<usize>

source§

fn as_slice(&self) -> &[usize]

source§

fn as_slice_mut(&mut self) -> &mut [usize]

source§

fn at_raw(&self, i: usize) -> usize

source§

fn push(&mut self, elem: usize)

source§

fn map<F: Fn(usize) -> usize>(&self, f: F) -> Self

source§

fn mut_map<F: Fn(&mut usize)>(&mut self, f: F)

source§

fn fold<F: Fn(usize, usize) -> usize>(&self, init: usize, f: F) -> usize

source§

fn filter<F: Fn(&usize) -> bool>(&self, f: F) -> Self

source§

fn take(&self, n: usize) -> Self

source§

fn skip(&self, n: usize) -> Self

source§

fn take_while<F: Fn(&usize) -> bool>(&self, f: F) -> Self

source§

fn skip_while<F: Fn(&usize) -> bool>(&self, f: F) -> Self

source§

fn zip_with<F: Fn(usize, usize) -> usize>(&self, f: F, other: &Self) -> Self

source§

impl Vector for Series

source§

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

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

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]));
}
source§

type Scalar = Scalar

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Ungil for T
where T: Send,