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: DTypeArraydtype: DType

Implementations

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));
}

Length for Series

Explicit type casting for Series

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.