Documentation ¶
Index ¶
- Constants
- Variables
- func IsEmpty(s string) bool
- func IsNaN(f float64) bool
- func Mean[T Number](x []T) float64
- func NaN() float64
- func Repeat[T GenericType](a T, n int) []T
- func Repeat2[T GenericType](dst []T, a T, n int) []T
- func SetParseExceptions(enabled bool)
- func SliceToFloat32(v any) []float32
- func ToBool(s Series) []bool
- func ToFloat32(s Series) []float32
- func ToFloat64(s Series) []float64
- type AlphaType
- type BigFloat
- type Complex
- type DataFrame
- func LoadMaps(maps []map[string]interface{}, options ...LoadOption) DataFrame
- func LoadMatrix(mat mat.Matrix) DataFrame
- func LoadRecords(records [][]string, options ...LoadOption) DataFrame
- func LoadStructs(i interface{}, options ...LoadOption) DataFrame
- func NewDataFrame(se ...Series) DataFrame
- func ReadCSV(in any, options ...LoadOption) DataFrame
- func ReadExcel(filename string, options ...LoadOption) DataFrame
- func (self DataFrame) Col(colname string) Series
- func (self DataFrame) Dims() (int, int)
- func (self DataFrame) Error() error
- func (self DataFrame) FillNa(v any, inplace bool)
- func (self DataFrame) Join(series Series) DataFrame
- func (self DataFrame) Names() []string
- func (self DataFrame) Ncol() int
- func (self DataFrame) Nrow() int
- func (self DataFrame) Records() [][]string
- func (self DataFrame) Remove(p ScopeLimit) DataFrame
- func (df DataFrame) Select(indexes SelectIndexes) DataFrame
- func (self DataFrame) SelectRows(p ScopeLimit) DataFrame
- func (self DataFrame) SetName(from string, to string)
- func (self DataFrame) SetNames(colnames ...string) error
- func (self DataFrame) String() (str string)
- func (self DataFrame) Subset(start, end int) DataFrame
- func (self DataFrame) Types() []string
- func (self DataFrame) WriteCSV(out any, options ...WriteOption) error
- func (self DataFrame) WriteExcel(filename string, options ...WriteOption) error
- type EW
- type ExponentialMovingWindow
- type Float
- type GenericType
- type Integer
- type Integer_old
- type LoadOption
- func DefaultType(t Type) LoadOption
- func DetectTypes(b bool) LoadOption
- func HasHeader(b bool) LoadOption
- func NaNValues(nanValues []string) LoadOption
- func Names(names ...string) LoadOption
- func WithComments(b rune) LoadOption
- func WithDelimiter(b rune) LoadOption
- func WithLazyQuotes(b bool) LoadOption
- func WithTypes(coltypes map[string]Type) LoadOption
- type NDFrame
- func (self *NDFrame) Append(values ...any)
- func (self *NDFrame) Apply(f func(idx int, v any))
- func (self *NDFrame) AsInt() []stat.Int
- func (self *NDFrame) Copy() Series
- func (self *NDFrame) DTypes() []stat.DType
- func (self *NDFrame) Diff(param any) (s Series)
- func (s *NDFrame) EWM(alpha EW) ExponentialMovingWindow
- func (self *NDFrame) Empty() Series
- func (self *NDFrame) FillNa(v any, inplace bool) Series
- func (self *NDFrame) Float() []float32
- func (self *NDFrame) Len() int
- func (self *NDFrame) Less(i, j int) bool
- func (self *NDFrame) Logic(f func(idx int, v any) bool) []bool
- func (self *NDFrame) Max() any
- func (self *NDFrame) Mean() stat.DType
- func (self *NDFrame) Min() any
- func (self *NDFrame) NaN() any
- func (self *NDFrame) Name() string
- func (self *NDFrame) Records() []string
- func (self *NDFrame) Ref(param any) (s Series)
- func (self *NDFrame) Rename(n string)
- func (self *NDFrame) Repeat(x any, repeats int) Series
- func (self *NDFrame) Rolling(param any) RollingAndExpandingMixin
- func (self *NDFrame) RollingV1(window int) RollingWindowV1
- func (self *NDFrame) Select(r ScopeLimit) Series
- func (self *NDFrame) Shift(periods int) Series
- func (self *NDFrame) Std() stat.DType
- func (self *NDFrame) StdDev() stat.DType
- func (self *NDFrame) Subset(start, end int, opt ...any) Series
- func (self *NDFrame) Sum() stat.DType
- func (self *NDFrame) Swap(i, j int)
- func (self *NDFrame) Type() Type
- func (self *NDFrame) Values() any
- type Number
- type Number16
- type Number32
- type Number64
- type Number8
- type NumberOfCPUBitsRelated
- type Ordered
- type RollingAndExpandingMixin
- func (r RollingAndExpandingMixin) Apply(f func(S Series, N stat.DType) stat.DType) (s Series)
- func (r RollingAndExpandingMixin) Apply_v1(f func(S Series, N stat.DType) stat.DType) (s Series)
- func (r RollingAndExpandingMixin) Count() (s Series)
- func (r RollingAndExpandingMixin) Max() (s Series)
- func (r RollingAndExpandingMixin) Mean() (s Series)
- func (r RollingAndExpandingMixin) Min() (s Series)
- func (r RollingAndExpandingMixin) Std() Series
- func (r RollingAndExpandingMixin) Sum() Series
- type RollingWindowV1
- type ScopeLimit
- type SelectIndexes
- type Series
- func GenericSeries[T GenericType](name string, values ...T) Series
- func NewSeries(t Type, name string, vals any) Series
- func NewSeriesWithType(_type Type, name string, values ...interface{}) Series
- func NewSeriesWithoutType(name string, values ...interface{}) Series
- func Shift[T GenericType](s *Series, periods int, cbNan func() T) Series
- func Shift2[T GenericType](s *Series, N []float32, cbNan func() T) Series
- type SeriesBool
- func (self *SeriesBool) Copy() Series
- func (self *SeriesBool) Empty() Series
- func (self *SeriesBool) FillNa(v any, inplace bool) Series
- func (self *SeriesBool) Len() int
- func (self *SeriesBool) Mean() float64
- func (self *SeriesBool) Name() string
- func (self *SeriesBool) Records() []string
- func (self *SeriesBool) Rename(n string)
- func (self *SeriesBool) Repeat(x any, repeats int) Series
- func (self *SeriesBool) RollingV1(window int) RollingWindowV1
- func (self *SeriesBool) Shift(periods int) Series
- func (self *SeriesBool) StdDev() float64
- func (self *SeriesBool) Subset(start, end int, opt ...any) Series
- func (self *SeriesBool) Type() Type
- func (self *SeriesBool) Values() any
- type SeriesFloat32
- func (self *SeriesFloat32) Copy() Series
- func (self *SeriesFloat32) Empty() Series
- func (self *SeriesFloat32) FillNa(v any, inplace bool)
- func (self *SeriesFloat32) Len() int
- func (self *SeriesFloat32) Max() any
- func (self *SeriesFloat32) Mean() float64
- func (self *SeriesFloat32) Name() string
- func (self *SeriesFloat32) Records() []string
- func (self *SeriesFloat32) Rename(n string)
- func (self *SeriesFloat32) Repeat(x any, repeats int) Series
- func (self *SeriesFloat32) RollingV1(window int) RollingWindowV1
- func (self *SeriesFloat32) Shift(periods int) Series
- func (self *SeriesFloat32) StdDev() float64
- func (self *SeriesFloat32) Subset(start, end int, opt ...any) Series
- func (self *SeriesFloat32) Type() Type
- func (self *SeriesFloat32) Values() any
- type SeriesFloat64
- func (self *SeriesFloat64) Copy() Series
- func (self *SeriesFloat64) Empty() Series
- func (self *SeriesFloat64) FillNa(v any, inplace bool) Series
- func (self *SeriesFloat64) Len() int
- func (self *SeriesFloat64) Mean() float64
- func (self *SeriesFloat64) Name() string
- func (self *SeriesFloat64) Records() []string
- func (self *SeriesFloat64) Rename(n string)
- func (self *SeriesFloat64) Repeat(x any, repeats int) Series
- func (self *SeriesFloat64) RollingV1(window int) RollingWindowV1
- func (self *SeriesFloat64) Shift(periods int) Series
- func (self *SeriesFloat64) StdDev() float64
- func (self *SeriesFloat64) Subset(start, end int, opt ...any) Series
- func (self *SeriesFloat64) Type() Type
- func (self *SeriesFloat64) Values() any
- type SeriesInt64
- func (self *SeriesInt64) Copy() Series
- func (self *SeriesInt64) Empty() Series
- func (self *SeriesInt64) FillNa(v any, inplace bool) Series
- func (self *SeriesInt64) Len() int
- func (self *SeriesInt64) Mean() float64
- func (self *SeriesInt64) Name() string
- func (self *SeriesInt64) Records() []string
- func (self *SeriesInt64) Rename(n string)
- func (self *SeriesInt64) Repeat(x any, repeats int) Series
- func (self *SeriesInt64) RollingV1(window int) RollingWindowV1
- func (self *SeriesInt64) Shift(periods int) Series
- func (self *SeriesInt64) StdDev() float64
- func (self *SeriesInt64) Subset(start, end int, opt ...any) Series
- func (self *SeriesInt64) Type() Type
- func (self *SeriesInt64) Values() any
- type SeriesString
- func (self *SeriesString) Copy() Series
- func (self *SeriesString) Empty() Series
- func (self *SeriesString) FillNa(v any, inplace bool) Series
- func (self *SeriesString) Len() int
- func (self *SeriesString) Mean() float64
- func (self *SeriesString) Name() string
- func (self *SeriesString) Records() []string
- func (self *SeriesString) Rename(n string)
- func (self *SeriesString) Repeat(x any, repeats int) Series
- func (self *SeriesString) RollingV1(window int) RollingWindowV1
- func (self *SeriesString) Shift(periods int) Series
- func (self *SeriesString) StdDev() float64
- func (self *SeriesString) Subset(start, end int, opt ...any) Series
- func (self *SeriesString) Type() Type
- func (self *SeriesString) Values() any
- type Signed
- type StringFormatter
- type Type
- type Unsigned
- type WriteOption
Constants ¶
const ( SERIES_TYPE_INVAILD = reflect.Invalid // 无效类型 SERIES_TYPE_BOOL = reflect.Bool // 布尔类型 SERIES_TYPE_INT64 = reflect.Int64 // int64 SERIES_TYPE_FLOAT32 = reflect.Float32 // float32 SERIES_TYPE_FLOAT64 = reflect.Float64 // float64 SERIES_TYPE_DTYPE = SERIES_TYPE_FLOAT64 SERIES_TYPE_STRING = reflect.String // string )
Supported Series Types
const (
MAX_FLOAT32_PRICE = float32(9999.9999) // float32的价最大阀值触发扩展到float64
)
Variables ¶
var ( // Nil2Float64 nil指针转换float64 Nil2Float64 = float64(0) // Nil2Float32 nil指针转换float32 Nil2Float32 = float32(0) )
var (
ErrUnsupportedType = exception.New(0, "Unsupported type")
)
var ( // IgnoreParseExceptions 忽略解析异常 IgnoreParseExceptions bool = true )
Functions ¶
func SliceToFloat32 ¶ added in v0.6.4
SliceToFloat32 any输入只能是一维slice或者数组
Types ¶
type AlphaType ¶
type AlphaType int
const ( // AlphaAlpha Specify smoothing factor α directly, 0<α≤1. AlphaAlpha AlphaType = iota // AlphaCom Specify decay in terms of center of mass, α=1/(1+com), for com ≥ 0. AlphaCom // AlphaSpan Specify decay in terms of span, α=2/(span+1), for span ≥ 1. AlphaSpan // AlphaHalfLife Specify decay in terms of half-life, α=1−exp(−ln(2)/halflife), for halflife > 0. AlphaHalfLife )
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.ewm.html
type Complex ¶ added in v0.6.4
type Complex interface { ~complex64 | ~complex128 }
Complex is a constraint that permits any complex numeric type. If future releases of Go add new predeclared complex numeric types, this constraint will be modified to include them.
type DataFrame ¶
type DataFrame struct { // deprecated: Use Error() instead Err error // contains filtered or unexported fields }
DataFrame 以gota的DataFrame的方法为主, 兼顾新流程, 避免单元格元素结构化
func LoadMaps ¶ added in v0.6.4
func LoadMaps(maps []map[string]interface{}, options ...LoadOption) DataFrame
LoadMaps creates a new DataFrame based on the given maps. This function assumes that every map on the array represents a row of observations.
func LoadMatrix ¶ added in v0.6.4
LoadMatrix loads the given Matrix as a DataFrame TODO: Add Loadoptions
func LoadRecords ¶
func LoadRecords(records [][]string, options ...LoadOption) DataFrame
LoadRecords creates a new DataFrame based on the given records. 这个方法是从本地缓存文件读取数据的第二步, 数据从形式上只能是字符串
func LoadStructs ¶
func LoadStructs(i interface{}, options ...LoadOption) DataFrame
LoadStructs creates a new DataFrame from arbitrary struct slices.
LoadStructs will ignore unexported fields inside an struct. Note also that unless otherwise specified the column names will correspond with the name of the field.
You can configure each field with the `dataframe:"name[,type]"` struct tag. If the name on the tag is the empty string `""` the field name will be used instead. If the name is `"-"` the field will be ignored.
Examples:
// field will be ignored field int // Field will be ignored Field int `dataframe:"-"` // Field will be parsed with column name Field and type int Field int // Field will be parsed with column name `field_column` and type int. Field int `dataframe:"field_column"` // Field will be parsed with column name `field` and type string. Field int `dataframe:"field,string"` // Field will be parsed with column name `Field` and type string. Field int `dataframe:",string"`
If the struct tags and the given LoadOptions contradict each other, the later will have preference over the former.
func NewDataFrame ¶
NewDataFrame is the generic DataFrame constructor
func ReadCSV ¶
func ReadCSV(in any, options ...LoadOption) DataFrame
ReadCSV reads a CSV file from a io.Reader and builds a DataFrame with the resulting records. 支持文件名和io两种方式读取数据
func ReadExcel ¶ added in v0.6.4
func ReadExcel(filename string, options ...LoadOption) DataFrame
读取excel文件
func (DataFrame) Col ¶ added in v0.6.3
Col returns a copy of the Series with the given column name contained in the DataFrame. 选取一列
func (DataFrame) Remove ¶ added in v0.6.3
func (self DataFrame) Remove(p ScopeLimit) DataFrame
Remove 删除一段范围内的记录
func (DataFrame) Select ¶ added in v0.6.3
func (df DataFrame) Select(indexes SelectIndexes) DataFrame
Select the given DataFrame columns
func (DataFrame) SelectRows ¶ added in v0.6.4
func (self DataFrame) SelectRows(p ScopeLimit) DataFrame
Select 选择一段记录
func (DataFrame) SetNames ¶ added in v0.6.3
SetNames changes the column names of a DataFrame to the ones passed as an argument. 修改全部的列名
func (DataFrame) Subset ¶
Subset returns a subset of the rows of the original DataFrame based on the Series subsetting indexes.
func (DataFrame) WriteCSV ¶
func (self DataFrame) WriteCSV(out any, options ...WriteOption) error
WriteCSV writes the DataFrame to the given io.Writer as a CSV file. 支持文件名和io两种方式写入数据
func (DataFrame) WriteExcel ¶ added in v0.6.4
func (self DataFrame) WriteExcel(filename string, options ...WriteOption) error
WriteExcel 支持文件名和io两种方式写入数据
type EW ¶
type EW struct { Com stat.DType // 根据质心指定衰减 Span stat.DType // 根据跨度指定衰减 HalfLife stat.DType // 根据半衰期指定衰减 Alpha stat.DType // 直接指定的平滑因子α Adjust bool // 除以期初的衰减调整系数以核算 相对权重的不平衡(将 EWMA 视为移动平均线) IgnoreNA bool // 计算权重时忽略缺失值 Callback func(idx int) stat.DType }
EW (Factor) 指数加权(EW)计算Alpha 结构属性非0即为有效启动同名算法
type ExponentialMovingWindow ¶
type ExponentialMovingWindow struct {
// contains filtered or unexported fields
}
ExponentialMovingWindow 加权移动窗口
func (ExponentialMovingWindow) Mean ¶
func (w ExponentialMovingWindow) Mean() Series
type Float ¶ added in v0.6.2
Float is a constraint that permits any floating-point type. If future releases of Go add new predeclared floating-point types, this constraint will be modified to include them.
type GenericType ¶
GenericType Series支持的所有类型
type Integer_old ¶ added in v0.6.4
Integer_old Integer is a constraint that permits any integer type. If future releases of Go add new predeclared integer types, this constraint will be modified to include them.
type LoadOption ¶
type LoadOption func(*loadOptions)
LoadOption is the type used to configure the load of elements
func DefaultType ¶
func DefaultType(t Type) LoadOption
DefaultType sets the defaultType option for loadOptions.
func DetectTypes ¶
func DetectTypes(b bool) LoadOption
DetectTypes sets the detectTypes option for loadOptions.
func HasHeader ¶
func HasHeader(b bool) LoadOption
HasHeader sets the hasHeader option for loadOptions.
func NaNValues ¶
func NaNValues(nanValues []string) LoadOption
NaNValues sets the nanValues option for loadOptions.
func WithComments ¶
func WithComments(b rune) LoadOption
WithComments sets the csv comment line detect to remove lines
func WithDelimiter ¶
func WithDelimiter(b rune) LoadOption
WithDelimiter sets the csv delimiter other than ',', for example '\t'
func WithLazyQuotes ¶
func WithLazyQuotes(b bool) LoadOption
WithLazyQuotes sets csv parsing option to LazyQuotes
func WithTypes ¶
func WithTypes(coltypes map[string]Type) LoadOption
WithTypes sets the types option for loadOptions.
type NDFrame ¶
type NDFrame struct {
// contains filtered or unexported fields
}
NDFrame 这里本意是想做一个父类, 实际的效果是一个抽象类
func FillNa ¶ added in v0.6.2
func FillNa[T GenericType](s *NDFrame, v T, inplace bool) *NDFrame
FillNa 填充NaN的元素为v inplace为真是修改series元素的值 如果v和Values()返回值的slice类型不一致就会panic
func NewNDFrame ¶
func NewNDFrame[E GenericType](name string, rows ...E) *NDFrame
func (*NDFrame) Diff ¶ added in v0.6.3
Diff 元素的第一个离散差 First discrete difference of element. Calculates the difference of a {klass} element compared with another element in the {klass} (default is element in previous row).
func (*NDFrame) EWM ¶ added in v0.6.4
func (s *NDFrame) EWM(alpha EW) ExponentialMovingWindow
EWM provides exponential weighted calculations.
func (*NDFrame) Rolling ¶
func (self *NDFrame) Rolling(param any) RollingAndExpandingMixin
Rolling RollingAndExpandingMixin
func (*NDFrame) RollingV1 ¶ added in v0.6.4
func (self *NDFrame) RollingV1(window int) RollingWindowV1
RollingV1 滑动窗口 Deprecated: 使用RollingAndExpandingMixin
func (*NDFrame) Select ¶ added in v0.6.3
func (self *NDFrame) Select(r ScopeLimit) Series
Select 选取一段记录
type NumberOfCPUBitsRelated ¶ added in v0.6.4
NumberOfCPUBitsRelated The number of CPU bits is related
type Ordered ¶ added in v0.6.4
Ordered is a constraint that permits any ordered type: any type that supports the operators < <= >= >. If future releases of Go add new ordered types, this constraint will be modified to include them.
type RollingAndExpandingMixin ¶ added in v0.6.3
type RollingAndExpandingMixin struct {
// contains filtered or unexported fields
}
RollingAndExpandingMixin 滚动和扩展静态横切
func (RollingAndExpandingMixin) Count ¶ added in v0.6.4
func (r RollingAndExpandingMixin) Count() (s Series)
func (RollingAndExpandingMixin) Max ¶ added in v0.6.4
func (r RollingAndExpandingMixin) Max() (s Series)
func (RollingAndExpandingMixin) Mean ¶ added in v0.6.3
func (r RollingAndExpandingMixin) Mean() (s Series)
Mean returns the rolling mean.
func (RollingAndExpandingMixin) Min ¶ added in v0.6.4
func (r RollingAndExpandingMixin) Min() (s Series)
func (RollingAndExpandingMixin) Std ¶ added in v0.6.4
func (r RollingAndExpandingMixin) Std() Series
func (RollingAndExpandingMixin) Sum ¶ added in v0.6.4
func (r RollingAndExpandingMixin) Sum() Series
type RollingWindowV1 ¶ added in v0.6.4
type RollingWindowV1 struct {
// contains filtered or unexported fields
}
RollingWindowV1 is used for rolling window calculations. Deprecated: 使用RollingAndExpandingMixin
func (RollingWindowV1) Max ¶ added in v0.6.4
func (r RollingWindowV1) Max() any
func (RollingWindowV1) Mean ¶ added in v0.6.4
func (r RollingWindowV1) Mean() (s Series)
Mean returns the rolling mean.
func (RollingWindowV1) Min ¶ added in v0.6.4
func (r RollingWindowV1) Min() any
func (RollingWindowV1) StdDev ¶ added in v0.6.4
func (r RollingWindowV1) StdDev() (s Series)
StdDev returns the rolling mean.
type ScopeLimit ¶ added in v0.6.5
ScopeLimit is used to specify a range. Both Start and End are inclusive. A nil value means no limit, so a Start of nil means 0 and an End of nil means no limit. The End value must always be equal to or larger than Start. Negative values are acceptable. A value of -2 means the second last row.
func IntsToRanges ¶ added in v0.6.3
func IntsToRanges(ints []int) []ScopeLimit
IntsToRanges will convert an already (ascending) ordered list of ints to a slice of Ranges.
Example:
import "sort" ints := []int{2,4,5,6,8,10,11,45,46} sort.Ints(ints) fmt.Println(IntsToRanges(ints)) // Output: R{2,2}, R{4,6}, R{8,8}, R{10,11}, R{45,46}
func RangeFinite ¶ added in v0.6.3
func RangeFinite(start int, end ...int) ScopeLimit
RangeFinite returns a ScopeLimit that has a finite span.
func (*ScopeLimit) Limits ¶ added in v0.6.5
func (r *ScopeLimit) Limits(length int) (s int, e int, _ error)
Limits is used to return the start and end limits of a ScopeLimit object for a given Dataframe or Series with length number of rows.
func (*ScopeLimit) NRows ¶ added in v0.6.5
func (r *ScopeLimit) NRows(length ...int) (int, error)
NRows returns the number of rows contained by ScopeLimit. If End is nil, then length must be provided.
func (ScopeLimit) String ¶ added in v0.6.5
func (r ScopeLimit) String() string
String implements Stringer interface.
type SelectIndexes ¶ added in v0.6.4
type SelectIndexes interface{}
SelectIndexes are the supported indexes used for the DataFrame.Select method. Currently supported are:
int // Matches the given index number []int // Matches all given index numbers []bool // Matches all columns marked as true string // Matches the column with the matching column name []string // Matches all columns with the matching column names Series [Int] // Same as []int Series [Bool] // Same as []bool Series [String] // Same as []string
type Series ¶
type Series interface { // Name 取得series名称 Name() string // Rename renames the series. Rename(name string) // Type returns the type of data the series holds. // 返回series的数据类型 Type() Type // Values 获得全部数据集 Values() any // NaN 输出默认的NaN NaN() any // Float 强制转成[]float32 Float() []float32 // DTypes 强制转[]stat.DType DTypes() []stat.DType // 强制转换成整型 AsInt() []stat.Int // Len 获得行数, 实现sort.Interface接口的获取元素数量方法 Len() int // Less 实现sort.Interface接口的比较元素方法 Less(i, j int) bool // Swap 实现sort.Interface接口的交换元素方法 Swap(i, j int) // Empty returns an empty Series of the same type Empty() Series // Copy 复制 Copy() Series // Records returns the elements of a Series as a []string Records() []string // Subset 获取子集 Subset(start, end int, opt ...any) Series // Repeat elements of an array. Repeat(x any, repeats int) Series // Shift index by desired number of periods with an optional time freq. // 使用可选的时间频率按所需的周期数移动索引. Shift(periods int) Series // RollingV1 creates new RollingWindowV1 // Deprecated: 使用RollingAndExpandingMixin RollingV1(window int) RollingWindowV1 // Rolling 序列化版本 Rolling(param any) RollingAndExpandingMixin // Mean calculates the average value of a series Mean() stat.DType // StdDev calculates the standard deviation of a series StdDev() stat.DType // FillNa Fill NA/NaN values using the specified method. FillNa(v any, inplace bool) Series // Max 找出最大值 Max() any // Min 找出最小值 Min() any // Select 选取一段记录 Select(r ScopeLimit) Series // Append 增加一批记录 Append(values ...any) // Apply 接受一个回调函数 Apply(f func(idx int, v any)) // Logic 逻辑处理 Logic(f func(idx int, v any) bool) []bool // Diff 元素的第一个离散差 Diff(param any) (s Series) // Ref 引用其它周期的数据 Ref(param any) (s Series) // Std 计算标准差 Std() stat.DType // Sum 计算累和 Sum() stat.DType // EWM Provide exponentially weighted (EW) calculations. // // Exactly one of “com“, “span“, “halflife“, or “alpha“ must be // provided if “times“ is not provided. If “times“ is provided, // “halflife“ and one of “com“, “span“ or “alpha“ may be provided. EWM(alpha EW) ExponentialMovingWindow }
func GenericSeries ¶
func GenericSeries[T GenericType](name string, values ...T) Series
GenericSeries 泛型方法, 构造序列, 比其它方式对类型的统一性要求更严格
func NewSeriesWithType ¶ added in v0.6.3
NewSeriesWithType 通过类型创新一个新series
func NewSeriesWithoutType ¶ added in v0.6.3
NewSeriesWithoutType 不带类型创新一个新series
type SeriesBool ¶
func NewSeriesBool ¶
func NewSeriesBool(name string, vals ...interface{}) *SeriesBool
NewSeriesBool creates a new series with the underlying type as bool.
func (*SeriesBool) Copy ¶
func (self *SeriesBool) Copy() Series
func (*SeriesBool) Empty ¶
func (self *SeriesBool) Empty() Series
func (*SeriesBool) FillNa ¶ added in v0.6.2
func (self *SeriesBool) FillNa(v any, inplace bool) Series
FillNa bool类型不可能在导入series还是NaN
func (*SeriesBool) Len ¶
func (self *SeriesBool) Len() int
func (*SeriesBool) Mean ¶
func (self *SeriesBool) Mean() float64
func (*SeriesBool) Name ¶
func (self *SeriesBool) Name() string
func (*SeriesBool) Records ¶
func (self *SeriesBool) Records() []string
func (*SeriesBool) Rename ¶
func (self *SeriesBool) Rename(n string)
func (*SeriesBool) RollingV1 ¶ added in v0.6.4
func (self *SeriesBool) RollingV1(window int) RollingWindowV1
func (*SeriesBool) Shift ¶
func (self *SeriesBool) Shift(periods int) Series
func (*SeriesBool) StdDev ¶
func (self *SeriesBool) StdDev() float64
func (*SeriesBool) Type ¶
func (self *SeriesBool) Type() Type
func (*SeriesBool) Values ¶
func (self *SeriesBool) Values() any
type SeriesFloat32 ¶ added in v0.6.2
type SeriesFloat32 struct {
NDFrame
}
TODO:留给于总的作业
func (*SeriesFloat32) Copy ¶ added in v0.6.2
func (self *SeriesFloat32) Copy() Series
func (*SeriesFloat32) Empty ¶ added in v0.6.2
func (self *SeriesFloat32) Empty() Series
func (*SeriesFloat32) FillNa ¶ added in v0.6.2
func (self *SeriesFloat32) FillNa(v any, inplace bool)
func (*SeriesFloat32) Len ¶ added in v0.6.2
func (self *SeriesFloat32) Len() int
func (*SeriesFloat32) Max ¶ added in v0.6.2
func (self *SeriesFloat32) Max() any
func (*SeriesFloat32) Mean ¶ added in v0.6.2
func (self *SeriesFloat32) Mean() float64
func (*SeriesFloat32) Name ¶ added in v0.6.2
func (self *SeriesFloat32) Name() string
func (*SeriesFloat32) Records ¶ added in v0.6.2
func (self *SeriesFloat32) Records() []string
func (*SeriesFloat32) Rename ¶ added in v0.6.2
func (self *SeriesFloat32) Rename(n string)
func (*SeriesFloat32) Repeat ¶ added in v0.6.2
func (self *SeriesFloat32) Repeat(x any, repeats int) Series
func (*SeriesFloat32) RollingV1 ¶ added in v0.6.4
func (self *SeriesFloat32) RollingV1(window int) RollingWindowV1
func (*SeriesFloat32) Shift ¶ added in v0.6.2
func (self *SeriesFloat32) Shift(periods int) Series
func (*SeriesFloat32) StdDev ¶ added in v0.6.2
func (self *SeriesFloat32) StdDev() float64
func (*SeriesFloat32) Subset ¶ added in v0.6.2
func (self *SeriesFloat32) Subset(start, end int, opt ...any) Series
func (*SeriesFloat32) Type ¶ added in v0.6.2
func (self *SeriesFloat32) Type() Type
func (*SeriesFloat32) Values ¶ added in v0.6.2
func (self *SeriesFloat32) Values() any
type SeriesFloat64 ¶
func NewSeriesFloat64 ¶
func NewSeriesFloat64(name string, vals ...interface{}) *SeriesFloat64
func (*SeriesFloat64) Copy ¶
func (self *SeriesFloat64) Copy() Series
func (*SeriesFloat64) Empty ¶
func (self *SeriesFloat64) Empty() Series
Empty returns an empty Series of the same type
func (*SeriesFloat64) FillNa ¶ added in v0.6.2
func (self *SeriesFloat64) FillNa(v any, inplace bool) Series
func (*SeriesFloat64) Len ¶
func (self *SeriesFloat64) Len() int
func (*SeriesFloat64) Mean ¶
func (self *SeriesFloat64) Mean() float64
Mean calculates the average value of a series
func (*SeriesFloat64) Name ¶
func (self *SeriesFloat64) Name() string
func (*SeriesFloat64) Records ¶
func (self *SeriesFloat64) Records() []string
Records returns the elements of a Series as a []string
func (*SeriesFloat64) Rename ¶
func (self *SeriesFloat64) Rename(n string)
func (*SeriesFloat64) RollingV1 ¶ added in v0.6.4
func (self *SeriesFloat64) RollingV1(window int) RollingWindowV1
Rolling creates new RollingWindowV1
func (*SeriesFloat64) Shift ¶
func (self *SeriesFloat64) Shift(periods int) Series
func (*SeriesFloat64) StdDev ¶
func (self *SeriesFloat64) StdDev() float64
func (*SeriesFloat64) Type ¶
func (self *SeriesFloat64) Type() Type
Type returns the type of data the series holds.
func (*SeriesFloat64) Values ¶
func (self *SeriesFloat64) Values() any
type SeriesInt64 ¶
func NewSeriesInt64 ¶
func NewSeriesInt64(name string, vals ...interface{}) *SeriesInt64
NewSeriesInt64 creates a new series with the underlying type as int64.
func (*SeriesInt64) Copy ¶
func (self *SeriesInt64) Copy() Series
func (*SeriesInt64) Empty ¶
func (self *SeriesInt64) Empty() Series
func (*SeriesInt64) FillNa ¶ added in v0.6.2
func (self *SeriesInt64) FillNa(v any, inplace bool) Series
FillNa int64没有NaN
func (*SeriesInt64) Len ¶
func (self *SeriesInt64) Len() int
func (*SeriesInt64) Mean ¶
func (self *SeriesInt64) Mean() float64
func (*SeriesInt64) Name ¶
func (self *SeriesInt64) Name() string
func (*SeriesInt64) Records ¶
func (self *SeriesInt64) Records() []string
Records returns the elements of a Series as a []string
func (*SeriesInt64) Rename ¶
func (self *SeriesInt64) Rename(n string)
func (*SeriesInt64) RollingV1 ¶ added in v0.6.4
func (self *SeriesInt64) RollingV1(window int) RollingWindowV1
func (*SeriesInt64) Shift ¶
func (self *SeriesInt64) Shift(periods int) Series
func (*SeriesInt64) StdDev ¶
func (self *SeriesInt64) StdDev() float64
func (*SeriesInt64) Type ¶
func (self *SeriesInt64) Type() Type
func (*SeriesInt64) Values ¶
func (self *SeriesInt64) Values() any
type SeriesString ¶
SeriesString 字符串类型序列
func NewSeriesString ¶
func NewSeriesString(name string, vals ...interface{}) *SeriesString
NewSeriesString creates a new series with the underlying type as string.
func (*SeriesString) Copy ¶
func (self *SeriesString) Copy() Series
func (*SeriesString) Empty ¶
func (self *SeriesString) Empty() Series
func (*SeriesString) FillNa ¶ added in v0.6.2
func (self *SeriesString) FillNa(v any, inplace bool) Series
func (*SeriesString) Len ¶
func (self *SeriesString) Len() int
func (*SeriesString) Mean ¶
func (self *SeriesString) Mean() float64
func (*SeriesString) Name ¶
func (self *SeriesString) Name() string
func (*SeriesString) Records ¶
func (self *SeriesString) Records() []string
func (*SeriesString) Rename ¶
func (self *SeriesString) Rename(n string)
func (*SeriesString) RollingV1 ¶ added in v0.6.4
func (self *SeriesString) RollingV1(window int) RollingWindowV1
func (*SeriesString) Shift ¶
func (self *SeriesString) Shift(periods int) Series
func (*SeriesString) StdDev ¶
func (self *SeriesString) StdDev() float64
func (*SeriesString) Type ¶
func (self *SeriesString) Type() Type
func (*SeriesString) Values ¶
func (self *SeriesString) Values() any
type Signed ¶ added in v0.6.4
Signed is a constraint that permits any signed integer type. If future releases of Go add new predeclared signed integer types, this constraint will be modified to include them.
type StringFormatter ¶
type StringFormatter func(val interface{}) string
StringFormatter is used to convert a value into a string. Val can be nil or the concrete type stored by the series.
type Type ¶
Type is a convenience alias that can be used for a more type safe way of reason and use Series types.
type Unsigned ¶ added in v0.6.4
Unsigned is a constraint that permits any unsigned integer type. If future releases of Go add new predeclared unsigned integer types, this constraint will be modified to include them. TODO:~uintptr应该是没有应用场景
type WriteOption ¶
type WriteOption func(*writeOptions)
WriteOption is the type used to configure the writing of elements
func WriteHeader ¶
func WriteHeader(b bool) WriteOption
WriteHeader sets the writeHeader option for writeOptions.
Source Files ¶
- builtin.go
- dataframe.go
- dataframe_csv.go
- dataframe_excel.go
- dataframe_fillna.go
- dataframe_indexes.go
- dataframe_join.go
- dataframe_map.go
- dataframe_matrix.go
- dataframe_options.go
- dataframe_records.go
- dataframe_remove.go
- dataframe_select.go
- dataframe_struct.go
- dataframe_subset.go
- dataframe_xstring.go
- generic.go
- generic_append.go
- generic_apply.go
- generic_convert.go
- generic_diff.go
- generic_ewm.go
- generic_fillna.go
- generic_max.go
- generic_min.go
- generic_number.go
- generic_range.go
- generic_ref.go
- generic_rolling.go
- generic_shift.go
- generic_sort.go
- generic_sum.go
- generic_type.go
- rolling_count.go
- rolling_max.go
- rolling_mean.go
- rolling_min.go
- rolling_std.go
- rolling_sum.go
- rolling_v1.go
- scope_limit.go
- series.go
- series_bool.go
- series_float32.go
- series_float64.go
- series_generic.go
- series_int64.go
- series_type.go
- series_xstring.go
- slice_float32.go
- slice_float64.go
- unsafe.go