Safe Haskell | None |
---|---|
Language | Haskell2010 |
TimeSeries library
- data DataPoint a
- data Series a
- emptySeries :: Series a
- series :: [(UTCTime, a)] -> Series a
- size :: Series a -> Int
- slice :: Series a -> UTCTime -> UTCTime -> Series a
- toList :: Series a -> [(UTCTime, a)]
- tsSeries :: [Integer] -> [a] -> Series a
- valueAt :: Series a -> UTCTime -> Maybe a
- values :: Series a -> [a]
- mean :: Fractional a => Series a -> a
- data HasHeader
- loadCSV :: HasHeader -> (Text -> UTCTime) -> FilePath -> IO (Series Double)
- saveCSV :: Series Double -> FilePath -> IO ()
Documentation
Data points is single index value od time series
Data structure for holding Series. Implementation should be hidden so it can be changed in the future
emptySeries :: Series a Source #
Create empty series
size :: Series a -> Int Source #
Get series size. Complexity O(n)
size (Series [DP 1 41.3, DP 2 52.22, DP 3 3.0]) == 3
slice :: Series a -> UTCTime -> UTCTime -> Series a Source #
Return series subset Complexity O(n)
slice (Series [DP 1 41.3, DP 2 52.22, DP 3 3.0]) 2 3 == Series [DP 2 52.22, DP 3 3.0] slice (Series [DP 1 41.3, DP 2 52.22, DP 3 3.0]) 5 23 == Series []
tsSeries :: [Integer] -> [a] -> Series a Source #
Create time series from timestamps and values
seriesFromSeconds [1, 2, 3] [41.3, 52.22, 3.0] == Series [DP 1970-01-01 00:00:01 UTC 2.3,DP 1970-01-01 00:00:02 UTC 4.5]
valueAt :: Series a -> UTCTime -> Maybe a Source #
Return data point value at given index Complexity O(n)
valueAt (Series [DP 1 41.3, DP 2 52.22, DP 3 3.0]) 2 == Just 52.22 valueAt (Series [DP 1 41.3, DP 2 52.22, DP 3 3.0]) 5 == Nothing
mean :: Fractional a => Series a -> a Source #
Return maximum value in the series