Safe Haskell | None |
---|---|
Language | Haskell2010 |
TimeSeries library
- data DataPoint a
- data Series a
- dpIndex :: DataPoint a -> UTCTime
- dpValue :: DataPoint a -> a
- emptySeries :: Series a
- rolling :: NominalDiffTime -> ([a] -> b) -> Series a -> Series b
- resample :: UTCTime -> TimeResolution -> ([a] -> b) -> Series a -> Series b
- series :: [(UTCTime, a)] -> Series a
- size :: Series a -> Int
- slice :: UTCTime -> UTCTime -> Series a -> Series a
- toList :: Series a -> [(UTCTime, a)]
- tsSeries :: [Integer] -> [a] -> Series a
- valueAt :: UTCTime -> Series a -> Maybe a
- values :: Series a -> [a]
- mean :: Fractional a => Series a -> a
- std :: Floating a => Series a -> a
- variance :: Floating a => Series a -> a
- data TimeResolution
- days :: Integer -> TimeResolution
- months :: Integer -> TimeResolution
- nextTime :: TimeResolution -> UTCTime -> UTCTime
- seconds :: Int -> TimeResolution
- years :: Integer -> TimeResolution
- 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
:: NominalDiffTime | Window size |
-> ([a] -> b) | Function applied to each window |
-> Series a | Input Series |
-> Series b | Converted Series |
Apply function to rolling window to create new Series Rolling window is also called Sliding Window.
:: UTCTime | Starting time |
-> TimeResolution | Resampling resolution |
-> ([a] -> b) | Function for aggregating data points |
-> Series a | Input series |
-> Series b | Resampled series |
Resample Time 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
:: UTCTime | Start time (inclusive) |
-> UTCTime | End time (inclusive) |
-> Series a | Input series |
-> Series a | Sliced Series |
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 []
:: [Integer] | List of index value given as number of seconds |
-> [a] | List of value |
-> Series a | Created Series |
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]
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 Time Series mean
data TimeResolution Source #
days :: Integer -> TimeResolution Source #
Create Time Resolution from days
months :: Integer -> TimeResolution Source #
Create Time Resolution from months
seconds :: Int -> TimeResolution Source #
Create Time Resolution from seconds
years :: Integer -> TimeResolution Source #
Create Time Resolution from years