pub struct ArrayColumn { /* private fields */ }Expand description
A column of arrays (pond-ts kind: 'array'): each row holds a list of
numbers, text and true/false values, mixed freely, or is a gap. An empty
list is a value, not a gap. Numbers must be finite.
let tags = ArrayColumn::from_options([
Some(vec!["a".into(), "b".into()]),
Some(vec![]),
None,
Some(vec![Scalar::from(1.0), true.into()]),
]);
let s = TimeSeries::new("s", vec![0, 1, 2, 3], vec![Column::optional("tags", tags)])?;
let tags = s.column("tags")?.arrays()?;
assert_eq!(tags.get(0), Some(&[Scalar::from("a"), "b".into()][..]));
assert_eq!(tags.get(1), Some(&[][..])); // empty, not a gap
assert_eq!(tags.get(2), None);In Arrow an array column is a list: TimeSeries::to_arrow writes one
when every element in the column is the same kind, and
TimeSeries::from_arrow reads lists of numbers, text or true/false
values. pond-ts has no Arrow form for arrays.
Implementations§
Source§impl ArrayColumn
impl ArrayColumn
Sourcepub fn from_options(
values: impl IntoIterator<Item = Option<Vec<Scalar>>>,
) -> Self
pub fn from_options( values: impl IntoIterator<Item = Option<Vec<Scalar>>>, ) -> Self
Build from optional lists; None is a gap.
Sourcepub fn get(&self, i: usize) -> Option<&[Scalar]>
pub fn get(&self, i: usize) -> Option<&[Scalar]>
The list at i, or None for a gap. Panics if i is out of range.
Sourcepub fn iter(&self) -> impl Iterator<Item = Option<&[Scalar]>> + '_
pub fn iter(&self) -> impl Iterator<Item = Option<&[Scalar]>> + '_
Iterate as Option<&[Scalar]>.
Sourcepub fn missing_count(&self) -> usize
pub fn missing_count(&self) -> usize
Number of gaps.
Trait Implementations§
Source§impl Clone for ArrayColumn
impl Clone for ArrayColumn
Source§impl Debug for ArrayColumn
impl Debug for ArrayColumn
Source§impl From<ArrayColumn> for ColumnData
impl From<ArrayColumn> for ColumnData
Source§fn from(c: ArrayColumn) -> Self
fn from(c: ArrayColumn) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ArrayColumn
Equal when the same rows are gaps and the lists hold the same elements
bit for bit (so -0.0 and 0.0 differ, as in number columns).
impl PartialEq for ArrayColumn
Equal when the same rows are gaps and the lists hold the same elements
bit for bit (so -0.0 and 0.0 differ, as in number columns).
Auto Trait Implementations§
impl Freeze for ArrayColumn
impl RefUnwindSafe for ArrayColumn
impl Send for ArrayColumn
impl Sync for ArrayColumn
impl Unpin for ArrayColumn
impl UnsafeUnpin for ArrayColumn
impl UnwindSafe for ArrayColumn
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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