dataframes

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataFrame

type DataFrame[T common.Frame] struct {
	Indexes []string
	Columns []string
	Values  [][]*T
	Series  []*series.Series[T]
	DType   string
}

func Apply

func Apply[S common.Frame, D common.Frame](s *DataFrame[S], fn func(*DataFrame[S]) *DataFrame[D]) (*DataFrame[D], error)

func AsType

func AsType[S common.Frame, D common.Frame](sourceDf *DataFrame[S]) (*DataFrame[D], error)

func NewDataframe

func NewDataframe[T common.Frame](
	indexes []string,
	columns []string,
	data [][]*T,
) (*DataFrame[T], error)

func NewDataframeWithRowMap

func NewDataframeWithRowMap[T common.Frame](
	indexes []string,
	columns []string,
	data map[string][]*T,
) (*DataFrame[T], error)

NewDataframeWithRowMap create data frame with map Row data

data := map[string][]int{
	"row1": {1,2,3},
	"row2": {4,5,6},
	"row3": {7,8,9}
}

func Transform added in v0.0.3

func Transform[S common.Frame, D common.Frame](sourceDf *DataFrame[S], fn func(*S) *D) (*DataFrame[D], error)

func (*DataFrame[T]) Agg

func (df *DataFrame[T]) Agg(methods []string) (*DataFrame[float64], error)

Agg Method support only: Max, Min, Sum, Avg

func (*DataFrame[T]) Apply

func (df *DataFrame[T]) Apply(f func(*T) *T) *DataFrame[T]

func (*DataFrame[T]) Drop

func (df *DataFrame[T]) Drop(colName []string) *DataFrame[T]

func (*DataFrame[T]) GetSeries

func (df *DataFrame[T]) GetSeries(Name string) *series.Series[T]

type IDataFrame

type IDataFrame[T common.Frame] interface {
	Apply(func(*T) *T) *DataFrame[T]
	GetSeries(string) *series.Series[T]
	Agg([]string) (*DataFrame[float64], error)
	Drop([]string) *DataFrame[T]
}

Jump to

Keyboard shortcuts

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