pandas

package module
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2023 License: Apache-2.0 Imports: 23 Imported by: 32

README

pandas

Sourcegraph Build Status codecov tag license

1. 介绍

golang版本的pandas

2. 功能/模块划分

2.1 特性列表
模块 一级功能 二级功能 进展情况
dataframe dataframe new [√]
dataframe 类型约束 string [√]
dataframe 类型约束 bool [√]
dataframe 类型约束 int64 [√]
dataframe 类型约束 float64 [√]
dataframe 泛型类型 支持全部的基础类型 [√]
dataframe 泛型类型 自动检测类型 [√] 优先级:string > bool > float > int
dataframe align series长度自动对齐 [√]
dataframe col 选择 [√]
dataframe col 新增1列 [√]
dataframe row 删除多行 [√]
dataframe name 改名, 支持单一列改名 [√]
series series new [√] series的列元素类型和reflect.Kind保持一致
series 伪泛型 构建 [√] 再新建series完成之后类型就确定了
series SeriesBool bool类型 [√]
series SeriesString string类型 [√]
series SeriesInt64 int64类型 [√]
series SeriesFloat64 float64类型 [√]
series rolling 支持序列化参数 [√]

3. 示例

3.1. dataframe
3.2. series

4. 参考的的代码:

Documentation

Index

Constants

View Source
const (
	SERIES_TYPE_INVAILD = reflect.Invalid // 无效类型
	SERIES_TYPE_BOOL    = reflect.Bool    // 布尔类型
	SERIES_TYPE_INT     = reflect.Int64   // int64
	SERIES_TYPE_FLOAT   = reflect.Float64 // float64
	SERIES_TYPE_STRING  = reflect.String  // string
)
View Source
const (
	Nil2Bool              = false      // 空指针转bool
	BoolNaN               = false      // bool 无效值
	True2Bool             = true       // true转bool
	False2Bool            = false      // false 转bool
	True2Float32  float32 = float32(1) // true转float32
	False2Float32 float32 = float32(0) // false转float32

	StringBad2Bool   = false // 字符串解析bool异常
	StringTrue2Bool  = true  // 字符串true转bool
	StringFalse2Bool = false // 字符串false转bool
)
View Source
const (
	MaxFloat32                  = math.MaxFloat32 // float32最大值
	StringTrue2Float32  float32 = float32(1)      // 字符串true转float32
	StringFalse2Float32 float32 = float32(0)      // 字符串false转float32
)
View Source
const (
	MaxFloat64          float64 = math.MaxFloat64 // float64最大值
	True2Float64        float64 = float64(1)      // true转float64
	False2Float64       float64 = float64(0)      // false转float64
	StringNil2Float     float64 = float64(0)      // deprecated: 字符串空指针转float64
	StringBad2Float     float64 = float64(0)      // deprecated: 字符串解析float64异常
	StringTrue2Float64  float64 = float64(1)      // 字符串true转float64
	StringFalse2Float64 float64 = float64(0)      // 字符串false转float64
)
View Source
const (
	Nil2Int64         = int64(0) // 空指针转int64
	IntNaN            = int64(0) // int64 无效值
	True2Int64        = int64(1) // true转int64
	False2Int64       = int64(0) // false 转int64
	StringBad2Int64   = int64(0) // 字符串解析int64异常
	StringTrue2Int64  = int64(1) // 字符串true转int64
	StringFalse2Int64 = int64(0) // 字符串false转int64
)
View Source
const (
	StringNaN    = "NaN"   // 字符串NaN
	Nil2String   = "NaN"   // nil指针转string
	True2String  = "true"  // true转string
	False2String = "false" // false转string
)

Variables

View Source
var (
	// Nil2Float64 nil指针转换float64
	Nil2Float64 = float64(0)
	// Nil2Float32 nil指针转换float32
	Nil2Float32 = float32(0)
)
View Source
var (
	// IgnoreParseExceptions 忽略解析异常
	IgnoreParseExceptions bool = true
)
View Source
var (
	// PossibleNaOfString 有可能出现的NaN字符串的全部选项
	PossibleNaOfString = []string{"NA", "NaN", "nan", "<nil>"}
)

Functions

func AnyToBool

func AnyToBool(v any) bool

AnyToBool any转换bool

func AnyToFloat32 added in v0.6.2

func AnyToFloat32(v any) float32

func AnyToFloat64

func AnyToFloat64(v any) float64

func AnyToInt64

func AnyToInt64(v any) int64

AnyToInt64 any转换int64

func AnyToString

func AnyToString(v any) string

AnyToString any转string

func DefaultFormatter

func DefaultFormatter(v interface{}) string

DefaultFormatter will return a string representation of the data in a particular row.

func DefaultIsEqualFunc

func DefaultIsEqualFunc(a, b interface{}) bool

DefaultIsEqualFunc is the default comparitor to determine if two values in the series are the same.

func Float32IsNaN added in v0.6.2

func Float32IsNaN(f float32) bool

Float32IsNaN 判断float32是否NaN

func Float64IsNaN added in v0.6.2

func Float64IsNaN(f float64) bool

Float64IsNaN 判断float64是否NaN

func IsEmpty

func IsEmpty(s string) bool

IsEmpty Code to test if string is empty

func IsNaN

func IsNaN(f float64) bool

IsNaN float64是否NaN

func Mean

func Mean[T Number](x []T) float64

Mean gonum.org/v1/gonum/stat不支持整型, 每次都要转换有点难受啊

func NaN

func NaN() float64

NaN returns an IEEE 754 “not-a-number” value.

func ParseBool

func ParseBool(s string, v any) bool

ParseBool 字符串转bool 任意组合的nan字符串都会被解析成NaN

func ParseFloat32 added in v0.6.2

func ParseFloat32(s string, v any) float32

ParseFloat32 字符串转float32

func ParseFloat64 added in v0.6.2

func ParseFloat64(s string, v any) float64

ParseFloat64 字符串转float64 任意组合的nan字符串都会被解析成NaN

func ParseInt64 added in v0.6.2

func ParseInt64(s string, v any) int64

ParseInt64 解析int字符串, 尝试解析10进制和16进制

func Repeat

func Repeat[T GenericType](a T, n int) []T

Repeat 重复生成a

func Repeat2

func Repeat2[T GenericType](dst []T, a T, n int) []T

Repeat2 重复生成a

func SetParseExceptions

func SetParseExceptions(enabled bool)

SetParseExceptions 设置处理解析异常的开关

func StringIsNaN

func StringIsNaN(s string) bool

StringIsNaN 判断字符串是否NaN

Types

type AlphaType

type AlphaType int
const (
	// Specify smoothing factor α directly, 0<α≤1.
	AlphaNil 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
)

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.ewm.html

type BigFloat added in v0.6.2

type BigFloat = big.Float // 预留将来可能扩展float

type DType

type DType = float64

type DataFrame

type DataFrame struct {

	// deprecated: Use Error() instead
	Err error
	// contains filtered or unexported fields
}

DataFrame 以gota的DataFrame的方法为主, 兼顾新流程, 避免单元格元素结构化

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

func NewDataFrame(se ...Series) DataFrame

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 (DataFrame) Col added in v0.6.3

func (self DataFrame) Col(colname string) Series

Col returns a copy of the Series with the given column name contained in the DataFrame. 选取一列

func (DataFrame) Dims

func (self DataFrame) Dims() (int, int)

Dims retrieves the dimensions of a DataFrame.

func (DataFrame) Error

func (self DataFrame) Error() error

Returns error or nil if no error occured

func (DataFrame) FillNa added in v0.6.2

func (self DataFrame) FillNa(v any, inplace bool)

FillNa dataframe实现FillNa

func (DataFrame) Join added in v0.6.3

func (self DataFrame) Join(series Series) DataFrame

Join 默认右连接, 加入一个series

func (DataFrame) Names

func (self DataFrame) Names() []string

Names returns the name of the columns on a DataFrame.

func (DataFrame) Ncol

func (self DataFrame) Ncol() int

Ncol returns the number of columns on a DataFrame.

func (DataFrame) Nrow

func (self DataFrame) Nrow() int

Nrow returns the number of rows on a DataFrame.

func (DataFrame) Records

func (self DataFrame) Records() [][]string

Records return the string record representation of a DataFrame.

func (DataFrame) Remove added in v0.6.3

func (self DataFrame) Remove(p Range) DataFrame

Remove 删除一段范围内的记录

func (DataFrame) Select added in v0.6.3

func (self DataFrame) Select(p Range) DataFrame

Select 选择一段记录

func (DataFrame) SetName added in v0.6.3

func (self DataFrame) SetName(from string, to string)

SetName 修改一个series的名称

func (DataFrame) SetNames added in v0.6.3

func (self DataFrame) SetNames(colnames ...string) error

SetNames changes the column names of a DataFrame to the ones passed as an argument. 修改全部的列名

func (DataFrame) String

func (self DataFrame) String() (str string)

String implements the Stringer interface for DataFrame

func (DataFrame) Subset

func (self DataFrame) Subset(start, end int) DataFrame

Subset returns a subset of the rows of the original DataFrame based on the Series subsetting indexes.

func (DataFrame) Types

func (self DataFrame) Types() []string

Types returns the types of the columns on a DataFrame.

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两种方式写入数据

type EW

type EW struct {
	Com      float64 // 根据质心指定衰减
	Span     float64 // 根据跨度指定衰减
	Halflife float64 // 根据半衰期指定衰减
	Alpha    float64 // 直接指定的平滑因子α
	Adjust   bool    // 除以期初的衰减调整系数以核算 相对权重的不平衡(将 EWMA 视为移动平均线)
	IgnoreNA bool    // 计算权重时忽略缺失值
}

EW (Factor) 指数加权(EW)计算Alpha 结构属性非0即为有效启动同名算法

type ExponentialMovingWindow

type ExponentialMovingWindow struct {
	// contains filtered or unexported fields
}

ExponentialMovingWindow 加权移动窗口

func (ExponentialMovingWindow) Mean

type Float added in v0.6.2

type Float interface {
	~float32 | ~float64
}

type Frame added in v0.6.3

type Frame[T GenericType] interface {
	// Name 取得series名称
	Name() string
	// ReName renames the series.
	ReName(name string)
	// Type returns the type of data the series holds.
	// 返回series的数据类型
	Type() Type
	// Len 获得行数
	Len() int
	// Values 获得全部数据集
	Values() []T // 如果确定类型, 后面可能无法自动调整
}

func NewFrame added in v0.6.3

func NewFrame[T GenericType](name string, values ...any) Frame[T]

type GenericFrame added in v0.6.3

type GenericFrame[T GenericType] struct {
	// contains filtered or unexported fields
}

func (*GenericFrame[T]) Len added in v0.6.3

func (self *GenericFrame[T]) Len() int

func (*GenericFrame[T]) Name added in v0.6.3

func (self *GenericFrame[T]) Name() string

func (*GenericFrame[T]) ReName added in v0.6.3

func (self *GenericFrame[T]) ReName(name string)

func (*GenericFrame[T]) Type added in v0.6.3

func (self *GenericFrame[T]) Type() Type

func (*GenericFrame[T]) Values added in v0.6.3

func (self *GenericFrame[T]) Values() []T

type GenericType

type GenericType interface {
	~bool | ~int64 | ~float64 | ~string
}

GenericType Series支持的所有类型

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 Names

func Names(names ...string) LoadOption

Names sets the names 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) Append added in v0.6.3

func (self *NDFrame) Append(values ...interface{})

Append 批量增加记录

func (*NDFrame) Apply added in v0.6.3

func (self *NDFrame) Apply(f func(idx int, v any))

func (*NDFrame) Copy

func (self *NDFrame) Copy() Series

Copy 复制一个副本

func (*NDFrame) Diff added in v0.6.3

func (self *NDFrame) Diff(param any) (s Series)

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) Empty

func (self *NDFrame) Empty() Series

func (*NDFrame) FillNa added in v0.6.2

func (self *NDFrame) FillNa(v any, inplace bool)

func (*NDFrame) Len

func (self *NDFrame) Len() int

func (*NDFrame) Max added in v0.6.2

func (self *NDFrame) Max() any

func (*NDFrame) Mean

func (self *NDFrame) Mean() float64

func (*NDFrame) Min added in v0.6.2

func (self *NDFrame) Min() any

func (*NDFrame) Name

func (self *NDFrame) Name() string

func (*NDFrame) Records

func (self *NDFrame) Records() []string

func (*NDFrame) Rename

func (self *NDFrame) Rename(n string)

func (*NDFrame) Repeat

func (self *NDFrame) Repeat(x any, repeats int) Series

func (*NDFrame) Rolling

func (self *NDFrame) Rolling(window int) RollingWindow

Rolling 滑动窗口

func (*NDFrame) Rolling2 added in v0.6.3

func (self *NDFrame) Rolling2(param any) RollingAndExpandingMixin

Rolling2 RollingAndExpandingMixin

func (*NDFrame) Select added in v0.6.3

func (self *NDFrame) Select(r Range) Series

Select 选取一段记录

func (*NDFrame) Shift

func (self *NDFrame) Shift(periods int) Series

func (*NDFrame) StdDev

func (self *NDFrame) StdDev() float64

func (*NDFrame) Subset

func (self *NDFrame) Subset(start, end int, opt ...any) Series

func (*NDFrame) Type

func (self *NDFrame) Type() Type

func (*NDFrame) Values

func (self *NDFrame) Values() any

type Number added in v0.6.2

type Number interface {
	Number8 | Number16 | Number32 | Number64 | Float | int | uint
}

Number int和uint的长度取决于CPU是多少位

type Number16 added in v0.6.2

type Number16 interface {
	~int16 | ~uint16
}

type Number32 added in v0.6.2

type Number32 interface {
	~int32 | ~uint32 | float32
}

type Number64 added in v0.6.2

type Number64 interface {
	~int64 | ~uint64 | float64
}

type Number8 added in v0.6.2

type Number8 interface {
	~int8 | ~uint8
}

type Range added in v0.6.3

type Range struct {
	Start *int
	End   *int
}

Range 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) []Range

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) Range

RangeFinite returns a Range that has a finite span.

func (*Range) Limits added in v0.6.3

func (r *Range) Limits(length int) (s int, e int, _ error)

Limits is used to return the start and end limits of a Range object for a given Dataframe or Series with length number of rows.

func (*Range) NRows added in v0.6.3

func (r *Range) NRows(length ...int) (int, error)

NRows returns the number of rows contained by Range. If End is nil, then length must be provided.

func (Range) String added in v0.6.3

func (r Range) String() string

String implements Stringer interface.

type RollingAndExpandingMixin added in v0.6.3

type RollingAndExpandingMixin struct {
	// contains filtered or unexported fields
}

RollingAndExpandingMixin 滚动和扩展静态横切

func (RollingAndExpandingMixin) Mean added in v0.6.3

func (r RollingAndExpandingMixin) Mean() (s Series)

Mean returns the rolling mean.

type RollingWindow

type RollingWindow struct {
	// contains filtered or unexported fields
}

RollingWindow is used for rolling window calculations.

func (RollingWindow) Max added in v0.6.2

func (r RollingWindow) Max() any

func (RollingWindow) Mean

func (r RollingWindow) Mean() (s Series)

Mean returns the rolling mean.

func (RollingWindow) Min added in v0.6.2

func (r RollingWindow) Min() any

func (RollingWindow) StdDev

func (r RollingWindow) StdDev() (s Series)

StdDev returns the rolling mean.

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
	// Len 获得行数
	Len() int
	// Values 获得全部数据集
	Values() any
	// 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
	// Rolling creates new RollingWindow
	Rolling(window int) RollingWindow
	// Rolling2 序列化版本
	Rolling2(param any) RollingAndExpandingMixin
	// Mean calculates the average value of a series
	Mean() float64
	// StdDev calculates the standard deviation of a series
	StdDev() float64
	// FillNa Fill NA/NaN values using the specified method.
	FillNa(v any, inplace bool)
	// Max 找出最大值
	Max() any
	// Min 找出最小值
	Min() any
	// Select 选取一段记录
	Select(r Range) Series
	// Append 增加一批记录
	Append(values ...interface{})
	// Apply 接受一个回调函数
	Apply(f func(idx int, v any))
	// Diff 元素的第一个离散差
	Diff(param any) (s Series)
}

func CreateSeries added in v0.6.2

func CreateSeries(t Type, name string, v ...any) Series

func GenericSeries

func GenericSeries[T GenericType](name string, values ...T) Series

GenericSeries 泛型方法, 构造序列, 比其它方式对类型的统一性要求更严格

func NewSeries

func NewSeries(t Type, name string, vals any) Series

NewSeries 指定类型创建序列

func NewSeriesWithType added in v0.6.3

func NewSeriesWithType(_type Type, name string, values ...interface{}) Series

NewSeriesWithType 通过类型创新一个新series

func NewSeriesWithoutType added in v0.6.3

func NewSeriesWithoutType(name string, values ...interface{}) Series

NewSeriesWithoutType 不带类型创新一个新series

func NewSeries_old added in v0.6.3

func NewSeries_old(t Type, name string, vals ...interface{}) *Series

func Shift

func Shift[T GenericType](s *Series, periods int, cbNan func() T) Series

Shift series切片, 使用可选的时间频率按所需的周期数移动索引

type SeriesBool

type SeriesBool struct {
	NDFrame
	Data []bool
}

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)

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) Repeat

func (self *SeriesBool) Repeat(x any, repeats int) Series

func (*SeriesBool) Rolling

func (self *SeriesBool) Rolling(window int) RollingWindow

func (*SeriesBool) Shift

func (self *SeriesBool) Shift(periods int) Series

func (*SeriesBool) StdDev

func (self *SeriesBool) StdDev() float64

func (*SeriesBool) Subset

func (self *SeriesBool) Subset(start, end int, opt ...any) Series

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) Rolling added in v0.6.2

func (self *SeriesFloat32) Rolling(window int) RollingWindow

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

type SeriesFloat64 struct {
	NDFrame
	Data []float64
}

func NewSeriesFloat64

func NewSeriesFloat64(name string, vals ...interface{}) *SeriesFloat64

func (*SeriesFloat64) Copy

func (self *SeriesFloat64) Copy() Series

func (*SeriesFloat64) EWM

EWM provides exponential weighted calculations.

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)

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) Repeat

func (self *SeriesFloat64) Repeat(x any, repeats int) Series

func (*SeriesFloat64) Rolling

func (self *SeriesFloat64) Rolling(window int) RollingWindow

Rolling creates new RollingWindow

func (*SeriesFloat64) Shift

func (self *SeriesFloat64) Shift(periods int) Series

func (*SeriesFloat64) StdDev

func (self *SeriesFloat64) StdDev() float64

func (*SeriesFloat64) Subset

func (self *SeriesFloat64) Subset(start, end int, opt ...any) Series

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

type SeriesInt64 struct {
	NDFrame
	Data []int64
}

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)

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) Repeat

func (self *SeriesInt64) Repeat(x any, repeats int) Series

func (*SeriesInt64) Rolling

func (self *SeriesInt64) Rolling(window int) RollingWindow

func (*SeriesInt64) Shift

func (self *SeriesInt64) Shift(periods int) Series

func (*SeriesInt64) StdDev

func (self *SeriesInt64) StdDev() float64

func (*SeriesInt64) Subset

func (self *SeriesInt64) Subset(start, end int, opt ...any) Series

func (*SeriesInt64) Type

func (self *SeriesInt64) Type() Type

func (*SeriesInt64) Values

func (self *SeriesInt64) Values() any

type SeriesString

type SeriesString struct {
	NDFrame
	Data []string
}

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)

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) Repeat

func (self *SeriesString) Repeat(x any, repeats int) Series

func (*SeriesString) Rolling

func (self *SeriesString) Rolling(window int) RollingWindow

func (*SeriesString) Shift

func (self *SeriesString) Shift(periods int) Series

func (*SeriesString) StdDev

func (self *SeriesString) StdDev() float64

func (*SeriesString) Subset

func (self *SeriesString) Subset(start, end int, opt ...any) Series

func (*SeriesString) Type

func (self *SeriesString) Type() Type

func (*SeriesString) Values

func (self *SeriesString) Values() any

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 Type = reflect.Kind

Type is a convenience alias that can be used for a more type safe way of reason and use Series types.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL