Documentation ¶
Index ¶
- Constants
- func Argmax(data Data) int
- func Argmin(data Data) int
- func IsNA(v DType) bool
- type AggregateFunc
- type AlphaType
- type DType
- func First(data Data) DType
- func Last(data Data) DType
- func Max(data Data) DType
- func Mean(data Data) DType
- func Median(data Data) DType
- func Min(data Data) DType
- func Skew(data Data) DType
- func Std(data Data, mean DType, ddof int) DType
- func Sum(data Data) DType
- func Variance(data Data, mean DType, ddof int) DType
- type DTypeSlice
- type Data
- func (d Data) Abs() Data
- func (d Data) Acos() Data
- func (d Data) Add(r Data) Data
- func (d Data) AddScalar(s DType) Data
- func (d Data) Append(r Data) Data
- func (d Data) AppendXY(x int64, y DType) Data
- func (d Data) Apply(fn func(DType) DType) Data
- func (d Data) Asin() Data
- func (d Data) At(i int) DType
- func (d Data) Atan() Data
- func (d Data) Ceil() Data
- func (d Data) Clone() Data
- func (d Data) Cos() Data
- func (d Data) Cumsum() Data
- func (d Data) DataReverse() Data
- func (d Data) Diff(periods int) Data
- func (d Data) Div(r Data) Data
- func (d Data) DivScalar(s DType) Data
- func (d Data) Dot(r Data) DType
- func (d Data) EWM(atype AlphaType, param DType, adjust bool, ignoreNA bool) ExpWindow
- func (d Data) Equals(r Data, eps DType) bool
- func (d Data) Exp() Data
- func (d Data) Exp2() Data
- func (d Data) Fillna(value DType) Data
- func (d Data) Floor() Data
- func (d Data) Freq() int64
- func (d Data) HasNA() bool
- func (d Data) Index() (index []int64)
- func (d Data) IndexAsFloat32() (index []float32)
- func (d Data) IndexAsFloat64() (index []float64)
- func (d Data) IndexAsInt32() (index []int32)
- func (d Data) IndexAt(i int) int64
- func (d Data) IndexEquals(r Data) bool
- func (d Data) IndexReverse() Data
- func (d Data) IndexSort() Data
- func (d Data) IndexSortStable() Data
- func (d Data) Len() int
- func (d Data) Lerp() Data
- func (d Data) Log() Data
- func (d Data) Log10() Data
- func (d Data) Log2() Data
- func (d Data) Max(r Data) Data
- func (d Data) Min(r Data) Data
- func (d Data) Mod(r Data) Data
- func (d Data) Mul(r Data) Data
- func (d Data) MulScalar(s DType) Data
- func (d Data) Pad() Data
- func (d Data) Pow(exp DType) Data
- func (d Data) Pow10() Data
- func (d Data) Resample(freq int64, origin ResampleOrigin) Resampler
- func (d Data) Resize(newLen int) Data
- func (d Data) Reverse() Data
- func (d Data) RollData(window int, cb func(l int, r int))
- func (d Data) Rolling(window int) Window
- func (d Data) Round() Data
- func (d Data) RoundToEven() Data
- func (d Data) Set(i int, v DType)
- func (d Data) SetXY(i int, x int64, y DType)
- func (d Data) Shift(periods int) Data
- func (d Data) Shrink() Data
- func (d Data) Sign() Data
- func (d Data) Sin() Data
- func (d Data) Slice(l, r int) Data
- func (d Data) Sort() Data
- func (d Data) SortStable() Data
- func (d Data) Sqr() Data
- func (d Data) String() string
- func (d Data) Sub(r Data) Data
- func (d Data) SubScalar(s DType) Data
- func (d Data) Tan() Data
- func (d Data) Trunc() Data
- func (d Data) Values() (values []DType)
- func (d Data) ValuesAsFloat32() (values []float32)
- func (d Data) ValuesAsFloat64() (values []float64)
- func (d Data) ValuesAsInt32() (values []int32)
- func (d Data) ValuesAsInt64() (values []int64)
- func (d Data) ValuesEquals(r Data, eps DType) bool
- func (d Data) XY(i int) (x, y float64)
- type ExpWindow
- type InterpolationMethod
- type ResampleOrigin
- type Resampler
- func (res Resampler) Apply(agg AggregateFunc) Data
- func (res Resampler) First() Data
- func (res Resampler) Interpolate(method InterpolationMethod) Data
- func (res Resampler) Last() Data
- func (res Resampler) Max() Data
- func (res Resampler) Mean() Data
- func (res Resampler) Median() Data
- func (res Resampler) Min() Data
- func (res Resampler) Sum() Data
- type Window
- func (w Window) Apply(agg AggregateFunc) Data
- func (w Window) Max() Data
- func (w Window) Mean() Data
- func (w Window) Median() Data
- func (w Window) Min() Data
- func (w Window) Skew(ma Data) Data
- func (w Window) Std(ma Data, ddof int) Data
- func (w Window) Sum() Data
- func (w Window) Variance(ma Data, ddof int) Data
Constants ¶
const ( EpsFp32 = 1e-7 EpsFp64 = 1e-14 Eps = EpsFp64 EnabledFloat32 = false )
const EnabledAVX2 = false
Variables ¶
This section is empty.
Functions ¶
func Argmax ¶ added in v0.0.6
Argmax returns offset of the biggest value of series data. If the maximum is achieved in multiple locations, the first row position is returned.
Types ¶
type AggregateFunc ¶ added in v0.1.0
AggregateFunc is applied aggregation function.
type AlphaType ¶ added in v0.0.3
type AlphaType int
const ( // Specify smoothing factor α directly, 0<α≤1. Alpha AlphaType = iota // Specify decay in terms of center of mass, α=1/(1+com), for com ≥ 0. AlphaCom // Specify decay in terms of span, α=2/(span+1), for span ≥ 1. AlphaSpan // Specify decay in terms of half-life, α=1−exp(−ln(2)/halflife), for halflife > 0. AlphaHalflife )
type DType ¶ added in v0.3.6
type DType = float64
func Median ¶ added in v0.3.7
Median returns median value of series. Linear interpolation is used for odd length.
type DTypeSlice ¶ added in v0.3.7
type DTypeSlice []DType
func (DTypeSlice) Len ¶ added in v0.3.7
func (x DTypeSlice) Len() int
func (DTypeSlice) Less ¶ added in v0.3.7
func (x DTypeSlice) Less(i, j int) bool
func (DTypeSlice) Swap ¶ added in v0.3.7
func (x DTypeSlice) Swap(i, j int)
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data is the series values container.
func MakeValues ¶ added in v0.3.8
MakeValues makes vector of values without indices. Any manipulations with index will cause panic or incorrect results!
func (Data) Cumsum ¶ added in v0.3.13
Cumsum returns cumulative sum over values. NaN values are ignored.
func (Data) DataReverse ¶ added in v0.3.0
Reverse reverses only values values.
func (Data) Equals ¶ added in v0.3.3
Equals tests data searies are equal to each other. NaN values are considered to be equal.
func (Data) Floor ¶ added in v0.0.9
Floor returns the greatest integer value less than or equal to x.
func (Data) IndexAsFloat32 ¶ added in v0.0.9
IndexAsFloat32 returns copy of underlying index slice converted to float32 array.
func (Data) IndexAsFloat64 ¶ added in v0.0.9
IndexAsFloat64 returns copy of underlying index slice converted to float64 array.
func (Data) IndexAsInt32 ¶ added in v0.3.0
IndexAsInt32 returns copy of underlying index slice converted to int32 array.
func (Data) IndexEquals ¶ added in v0.3.4
func (Data) IndexReverse ¶ added in v0.3.4
Reverse reverses only index values.
func (Data) IndexSortStable ¶ added in v0.3.4
IndexSortStable sorts data's index using stable sort algorithm.
func (Data) Lerp ¶ added in v0.3.2
Lerp fills NaNs between known values by linear interpolation method.
func (Data) Pad ¶ added in v0.3.0
Pad fills NaNs by previous values.
If series starts with NaN, it will be filled by the first non-NaN value.
func (Data) Resize ¶ added in v0.3.0
Resize resizes underlying arrays.
New index values are filled by MaxInt64. New values values are filled by NaN.
func (Data) RollData ¶
RollData applies custom function to rolling window of values. Function accepts window bounds.
func (Data) Round ¶ added in v0.0.9
Round returns the nearest integer, rounding half away from zero.
func (Data) RoundToEven ¶ added in v0.0.9
RoundToEven returns the nearest integer, rounding ties to even.
func (Data) Shrink ¶ added in v0.6.1
Shrink removes na values.
New Data instance will be returned. Old and new have the same internal arrays. No additional memory is used.
Safe for the empty index.
func (Data) SortStable ¶ added in v0.2.0
SortStable sorts data's index using stable sort algorithm.
func (Data) String ¶ added in v0.4.1
String converts time series columns to string. Index values are rendered as time.Duration.
func (Data) ValuesAsFloat32 ¶ added in v0.6.1
ValuesAsFloat32 returns copy of underlying values slice converted to float32 array.
func (Data) ValuesAsFloat64 ¶ added in v0.6.1
DataAsFloat64 returns copy of underlying values slice converted to float64 array.
func (Data) ValuesAsInt32 ¶ added in v0.6.1
ValuesAsInt32 returns copy of underlying values slice converted to int32 array.
func (Data) ValuesAsInt64 ¶ added in v0.6.1
ValuesAsInt64 returns copy of underlying values slice converted to float32 array.
type ExpWindow ¶ added in v0.0.3
type ExpWindow struct {
// contains filtered or unexported fields
}
type InterpolationMethod ¶ added in v0.3.0
type InterpolationMethod int
InterpolationMethod is the method of filling NaN values.
const ( // InterpolationLinear fills NaNs by linear interpolation method. InterpolationLinear InterpolationMethod = iota // InterpolationPad fills NaNs by existing values. InterpolationPad // InterpolationNone doesn't fill NaNs. InterpolationNone )
type ResampleOrigin ¶ added in v0.1.0
type ResampleOrigin int
ResampleOrigin is the timestamp (milliseconds) on which to adjust the grouping. The timezone of origin must match the timezone of the index.
const ( // OriginEpoch is 1970-01-01. OriginEpoch ResampleOrigin = iota // OriginStart is the first value of the timeseries. OriginStart // OriginStartDay is the first day at midnight of the timeseries. OriginStartDay )
type Resampler ¶ added in v0.1.0
type Resampler struct {
// contains filtered or unexported fields
}
Resampler resamples time-series data. Not full groups will are filled by NaNs.
func (Resampler) Apply ¶ added in v0.1.0
func (res Resampler) Apply(agg AggregateFunc) Data
Apply applies custom function to sample group.
func (Resampler) Interpolate ¶ added in v0.3.2
func (res Resampler) Interpolate(method InterpolationMethod) Data
Interpolate fills all NaNs between known values after applied upsamping.