timeseries-0.2.0: Library for Time Series processing

Safe HaskellNone
LanguageHaskell2010

Data.TimeSeries

Description

TimeSeries library

Synopsis

Documentation

data DataPoint a Source #

Data points is single index value od time series

Instances

Functor DataPoint Source # 

Methods

fmap :: (a -> b) -> DataPoint a -> DataPoint b #

(<$) :: a -> DataPoint b -> DataPoint a #

Foldable DataPoint Source # 

Methods

fold :: Monoid m => DataPoint m -> m #

foldMap :: Monoid m => (a -> m) -> DataPoint a -> m #

foldr :: (a -> b -> b) -> b -> DataPoint a -> b #

foldr' :: (a -> b -> b) -> b -> DataPoint a -> b #

foldl :: (b -> a -> b) -> b -> DataPoint a -> b #

foldl' :: (b -> a -> b) -> b -> DataPoint a -> b #

foldr1 :: (a -> a -> a) -> DataPoint a -> a #

foldl1 :: (a -> a -> a) -> DataPoint a -> a #

toList :: DataPoint a -> [a] #

null :: DataPoint a -> Bool #

length :: DataPoint a -> Int #

elem :: Eq a => a -> DataPoint a -> Bool #

maximum :: Ord a => DataPoint a -> a #

minimum :: Ord a => DataPoint a -> a #

sum :: Num a => DataPoint a -> a #

product :: Num a => DataPoint a -> a #

Eq a => Eq (DataPoint a) Source # 

Methods

(==) :: DataPoint a -> DataPoint a -> Bool #

(/=) :: DataPoint a -> DataPoint a -> Bool #

Show a => Show (DataPoint a) Source # 

data Series a Source #

Data structure for holding Series. Implementation should be hidden so it can be changed in the future

Instances

Functor Series Source # 

Methods

fmap :: (a -> b) -> Series a -> Series b #

(<$) :: a -> Series b -> Series a #

Foldable Series Source # 

Methods

fold :: Monoid m => Series m -> m #

foldMap :: Monoid m => (a -> m) -> Series a -> m #

foldr :: (a -> b -> b) -> b -> Series a -> b #

foldr' :: (a -> b -> b) -> b -> Series a -> b #

foldl :: (b -> a -> b) -> b -> Series a -> b #

foldl' :: (b -> a -> b) -> b -> Series a -> b #

foldr1 :: (a -> a -> a) -> Series a -> a #

foldl1 :: (a -> a -> a) -> Series a -> a #

toList :: Series a -> [a] #

null :: Series a -> Bool #

length :: Series a -> Int #

elem :: Eq a => a -> Series a -> Bool #

maximum :: Ord a => Series a -> a #

minimum :: Ord a => Series a -> a #

sum :: Num a => Series a -> a #

product :: Num a => Series a -> a #

Eq a => Eq (Series a) Source # 

Methods

(==) :: Series a -> Series a -> Bool #

(/=) :: Series a -> Series a -> Bool #

Show a => Show (Series a) Source # 

Methods

showsPrec :: Int -> Series a -> ShowS #

show :: Series a -> String #

showList :: [Series a] -> ShowS #

emptySeries :: Series a Source #

Create empty series

series :: [(UTCTime, a)] -> Series a Source #

Create 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 []

toList :: Series a -> [(UTCTime, a)] Source #

Convert Time Series to list

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

values :: Series a -> [a] Source #

Get only series values

mean :: Fractional a => Series a -> a Source #

Return maximum value in the series

data HasHeader Source #

Constructors

HasHeader 
NoHeader 

loadCSV :: HasHeader -> (Text -> UTCTime) -> FilePath -> IO (Series Double) Source #

Load data from CSV file and create Time Series from it As a first argument provide function to convert date from ByteString to UTCTime

saveCSV :: Series Double -> FilePath -> IO () Source #

Load data from CSV file and create Time Series from it As a first argument provide function to convert date from ByteString to UTCTime