dataframe

package
v0.0.43 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToFloat64 added in v0.0.41

func ToFloat64(val interface{}) (float64, bool)

Helper function to convert a value to float64

Types

type DataFrame

type DataFrame struct {
	Name       string
	StructType reflect.Type
	Data       map[int]interface{}
	Index      *db.BPlusTree // Use the BPlusTree from db package
	// contains filtered or unexported fields
}

func NewDataFrame

func NewDataFrame(data interface{}) (*DataFrame, error)

func ReadCSVFromFile

func ReadCSVFromFile(csvFilePath string, v interface{}) (*DataFrame, error)

ReadCSVFromFile takes a CSV file path and a pointer to a struct, populates the struct with the CSV data.

func ReadCSVFromString

func ReadCSVFromString(csvData string, v interface{}) (*DataFrame, error)

ReadCSVFromString takes a CSV string and a pointer to a struct, populates the struct with the CSV data.

func ReadJSONFromFile

func ReadJSONFromFile(jsonFilePath string, v interface{}) (*DataFrame, error)

ReadJSONFromFile takes a JSON file path and a pointer to a struct, populates the struct with the JSON data.

func ReadJSONFromString

func ReadJSONFromString(jsonData string, v interface{}) (*DataFrame, error)

ReadJSONFromString takes a JSON string and a pointer to a slice of structs, populates the slice with the JSON data.

func (*DataFrame) Corr

func (df *DataFrame) Corr() (*DataFrame, error)

Corr calculates the correlation matrix for the numerical columns in the DataFrame.

func (*DataFrame) DeleteRow added in v0.0.40

func (df *DataFrame) DeleteRow(id int) error

func (*DataFrame) Display

func (df *DataFrame) Display() error

Display prints the contents of the DataFrame to the console.

func (*DataFrame) FromStructs

func (df *DataFrame) FromStructs(data interface{}) error

FromStructs creates a DataFrame from a slice of structs.

func (*DataFrame) Head

func (df *DataFrame) Head(n ...int) ([]map[string]interface{}, error)

func (*DataFrame) Info

func (df *DataFrame) Info() error

func (*DataFrame) InsertRow added in v0.0.40

func (df *DataFrame) InsertRow(id int, row interface{})

func (*DataFrame) Join added in v0.0.37

func (df *DataFrame) Join(other *DataFrame, joinType string, keys []string) (*DataFrame, error)

func (*DataFrame) Loc

func (df *DataFrame) Loc(indices ...int) ([]map[string]interface{}, error)

func (*DataFrame) ReadRow added in v0.0.40

func (df *DataFrame) ReadRow(id int) (interface{}, error)

func (*DataFrame) Tail

func (df *DataFrame) Tail(n ...int) ([]map[string]interface{}, error)

func (*DataFrame) ToCSV

func (df *DataFrame) ToCSV(csvFilePath string) error

ToCSV writes the contents of a DataFrame to a CSV file.

func (*DataFrame) ToMatrix

func (df *DataFrame) ToMatrix() ([][]float64, []string, error)

ToMatrix converts the DataFrame to a 2D slice of float64 and returns the column names.

func (*DataFrame) UpdateRow added in v0.0.40

func (df *DataFrame) UpdateRow(id int, newValues map[string]interface{}) error

Jump to

Keyboard shortcuts

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