[−][src]Struct timeseries::TimeSeries
Time Series with normalized data
- index - Index based on timestamp in millisecond resolution
- values - Data points
Fields
index: Vec<i64>
values: Array1<f64>
Methods
impl TimeSeries
[src]
pub fn empty() -> TimeSeries
[src]
Create empty Time Series
pub fn new(index: Vec<i64>, values: Vec<f64>) -> TimeSeries
[src]
Create a new Time Series from from index and data
Example
use timeseries::TimeSeries; let index = vec![1, 2, 3, 4, 5]; let data = vec![1.0, 2.5, 3.2, 4.0, 3.0]; let ts = TimeSeries::new(index, data); assert_eq!(ts.length(), 5);
pub fn from_datapoints(datapoints: Vec<DataPoint>) -> TimeSeries
[src]
Create a new Time Series from from rows of tuples of timestamp and value
Example
use timeseries::{TimeSeries, DataPoint}; let data = vec![DataPoint::new(1, 1.0), DataPoint::new(2, 2.5), DataPoint::new(3, 3.2), DataPoint::new(4, 4.0), DataPoint::new(5, 3.0)]; let ts = TimeSeries::from_datapoints(data); assert_eq!(ts.length(), 5);
pub fn length(&self) -> usize
[src]
Returns the number of elements in the series.
Example
use timeseries::TimeSeries; let index = vec![1, 2, 3, 4, 5]; let data = vec![1.0, 2.5, 3.2, 4.0, 3.0]; let ts = TimeSeries::new(index, data); assert_eq!(ts.length(), 5);
pub fn nth(&self, pos: usize) -> Option<DataPoint>
[src]
Return nth element of the series.
Example
use timeseries::{TimeSeries, DataPoint}; let index = vec![1, 2, 3, 4, 5]; let data = vec![1.0, 2.5, 3.2, 4.0, 3.0]; let ts = TimeSeries::new(index, data); assert_eq!(ts.nth(1), Some(DataPoint::new(2, 2.5))); assert_eq!(ts.nth(10), None);
pub fn at(&self, timestamp: i64) -> f64
[src]
Return element by its timestamp index. Or 0 if not found
Example
use timeseries::TimeSeries; let index = vec![100, 160, 220]; let data = vec![1.0, 2.5, 3.2]; let ts = TimeSeries::new(index, data); assert_eq!(ts.at(10), 0.0); assert_eq!(ts.at(110), 1.0); assert_eq!(ts.at(165), 2.5); assert_eq!(ts.at(500), 3.2);
pub fn iter(&self) -> TimeSeriesIter
[src]
Create iterator
pub fn merge(&self, other: &TimeSeries) -> TimeSeries
[src]
Merge 2 series. The resulting series will contain data points from both series If series contains data point with the same timestamp, then the value from first series is taken
Example
Trait Implementations
impl Clone for TimeSeries
[src]
fn clone(&self) -> TimeSeries
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for TimeSeries
[src]
impl Display for TimeSeries
[src]
impl FromIterator<DataPoint> for TimeSeries
[src]
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = DataPoint>,
[src]
T: IntoIterator<Item = DataPoint>,
impl PartialEq<TimeSeries> for TimeSeries
[src]
Auto Trait Implementations
impl RefUnwindSafe for TimeSeries
impl Send for TimeSeries
impl Sync for TimeSeries
impl Unpin for TimeSeries
impl UnwindSafe for TimeSeries
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,