1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::prelude::*;
use num::Zero;
impl<T> ChunkPeaks for ChunkedArray<T>
where
T: PolarsNumericType,
T::Native: NumComp + Zero,
{
fn peak_max(&self) -> BooleanChunked {
(self.shift_and_fill(1, Some(Zero::zero())).lt(self))
& (self.shift_and_fill(-1, Some(Zero::zero())).lt(self))
}
fn peak_min(&self) -> BooleanChunked {
(self.shift_and_fill(1, Some(Zero::zero())).gt(self))
& (self.shift_and_fill(-1, Some(Zero::zero())).gt(self))
}
}
impl ChunkPeaks for BooleanChunked {}
impl ChunkPeaks for Utf8Chunked {}
impl ChunkPeaks for CategoricalChunked {}
impl ChunkPeaks for ListChunked {}
#[cfg(feature = "object")]
impl<T> ChunkPeaks for ObjectChunked<T> where
T: 'static + std::fmt::Debug + Clone + Send + Sync + Default
{
}