dataFrame

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNewCSV

func CreateNewCSV(filePath string, columns []string, delimiter rune) error

CreateNewCSV creates a new csv file with the specified columns and saves it at filePath. If the file already exists, it not will be overwritten.

Types

type DataFrame

type DataFrame struct {
	Columns []string   // column names
	Data    [][]string // rows of data (each row is a slice of strings)
	// contains filtered or unexported fields
}

DataFrame is a structure for storing tabular data

func NewDataFrame

func NewDataFrame(delimiter rune) *DataFrame

NewDataFrame creates an empty DataFrame with a specified delimiter

func (*DataFrame) AddColumn

func (df *DataFrame) AddColumn(name string, values []string) error

AddColumn adds a column to df

func (*DataFrame) AddRow

func (df *DataFrame) AddRow(row []string) error

AddRow adds a row to df.Data

func (*DataFrame) AddRowAndSave

func (df *DataFrame) AddRowAndSave(row []string, filepath string) error

AddRowAndSave adds a row and saves the DataFrame to a CSV file

func (*DataFrame) AddUniqueRow

func (df *DataFrame) AddUniqueRow(row []string) error

AddUniqueRow adds a row only if it is not already in the DataFrame

func (*DataFrame) AddUniqueRowAndSave

func (df *DataFrame) AddUniqueRowAndSave(row []string, filepath string) error

AddUniqueRowAndSave adds a row only if it is not already in the DataFrame and saves the DataFrame to a CSV file

func (*DataFrame) DeleteRow

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

DeleteRow deletes a row by its index

func (*DataFrame) DeleteRowAndSave

func (df *DataFrame) DeleteRowAndSave(index int, filePath string) error

DeleteRowAndSave deletes the row by index and saves the DataFrame to a CSV file

func (*DataFrame) DeleteRowByColumnValue

func (df *DataFrame) DeleteRowByColumnValue(columnName, value string) error

DeleteRowByColumnValue deletes the first row by value in the specified column

func (*DataFrame) DeleteRowByColumnValueAndSave

func (df *DataFrame) DeleteRowByColumnValueAndSave(columnName, value, filePath string) error

DeleteRowByColumnValueAndSave deletes the row by index and saves the DataFrame to a CSV file and saves the DataFrame to a CSV file

func (*DataFrame) GetAllColumns

func (df *DataFrame) GetAllColumns() [][]string

GetAllColumns returns a two-dimensional array: each inner array is a separate column

func (*DataFrame) GetColumnByName

func (df *DataFrame) GetColumnByName(name string) ([]string, error)

GetColumnByName returns all column values by name

func (*DataFrame) GetRowsAsStrings

func (df *DataFrame) GetRowsAsStrings(delimeter string) []string

GetRowsAsStrings returns a slice of rows, where each row is a these are the combined values of a single DataFrame data string using a delimiter

func (*DataFrame) LoadCSV

func (df *DataFrame) LoadCSV(filePath string) error

LoadCSV loads data from a CSV file into the DataFrame

func (*DataFrame) SaveCSV

func (df *DataFrame) SaveCSV(filePath string) error

SaveCSV saves the DataFrame to a CSV file

Jump to

Keyboard shortcuts

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