dataframe

package
v0.1.0-prealpha Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 7 Imported by: 0

README

Dataframe

To Implement:

  • Dataframes
    • Shape
    • Columns
    • Head
    • Tail
    • Index
    • SetIndex
    • ResetIndex
    • ... (more to come)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSQL

func ParseSQL(sql string) (string, error)

Types

type CSVSettings

type CSVSettings struct {
	Header      bool
	Separator   rune
	IndexColumn string
	SkipRows    []int
}

CSVSettings defines a struct that contains settings for reading a CSV file, allows for optional settings

type DataFrame

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

DataFrame is a collection of series.Series with a shared index. It is similar to a table in a relational database, and is implemented similar to a dataframe in R or Python (pandas).

func FromCSV

func FromCSV(path string, settings ...CSVSettings) *DataFrame

FromCSV reads a CSV file and returns a DataFrame

func New

func New(se ...series.Series) DataFrame

New creates a new DataFrame from a collection of series.Series. It has a shared index which defaults to a range of integers.

func (*DataFrame) Append

func (df *DataFrame) Append(s series.Series)

Append appends a series.Series to right of the DataFrame.

func (DataFrame) At

func (df DataFrame) At(i, j int) any

At returns the value at the specified row and column of the DataFrame.

func (DataFrame) Column

func (df DataFrame) Column(name string) *series.Series

Column returns a series.Series of the DataFrame by name.

func (DataFrame) Columns

func (df DataFrame) Columns() []series.Series

Columns returns a collection of the series.Series of the DataFrame.

func (DataFrame) Copy

func (df DataFrame) Copy() DataFrame

Copy returns a deep copy of the DataFrame.

func (*DataFrame) Drop

func (df *DataFrame) Drop(name string) series.Series

Drop removes the specified column from the DataFrame and returns it as a series.Series.

func (DataFrame) Head

func (df DataFrame) Head(n ...int) DataFrame

Head returns a slice of the last n elements of the DataFrame. If n is not specified, it defaults to 5.

func (DataFrame) Index

func (df DataFrame) Index() series.Series

Index returns the index of the DataFrame.

func (DataFrame) Names

func (df DataFrame) Names() []string

Names returns a collection of the names of the series.Series of the DataFrame.

func (DataFrame) Order

func (df DataFrame) Order(positions ...int) DataFrame

Order orders the DataFrame inplace according to the specified positions.

func (DataFrame) ResetIndex

func (df DataFrame) ResetIndex() DataFrame

ResetIndex resets the index of the DataFrame to a range of integers.

func (DataFrame) SelectNumericNames

func (df DataFrame) SelectNumericNames() []string

SelectNumericNames returns a collection of the names of numeric columns of the DataFrame.

func (DataFrame) SelectObjectNames

func (df DataFrame) SelectObjectNames() []string

SelectObjectNames returns a collection of the names of object columns of the DataFrame.

func (DataFrame) SetIndex

func (df DataFrame) SetIndex(s series.Series) DataFrame

SetIndex sets the index of the DataFrame to a specified series.Series.

func (DataFrame) Shape

func (df DataFrame) Shape() (int, int)

Shape returns the dimensions of the DataFrame in the form (nrows, ncols).

func (DataFrame) Slice

func (df DataFrame) Slice(a, b int) DataFrame

Slice returns a new DataFrame with rows from a to b

func (DataFrame) Sort

func (df DataFrame) Sort(columns ...string)

Sort sorts the DataFrame inplace according to the specified columns.

func (DataFrame) String

func (df DataFrame) String() string

String is the Stringer implementation for DataFrame.

func (DataFrame) Swap

func (df DataFrame) Swap(row1, row2 int)

Swap swaps the rows at index row1 and row2 of the DataFrame inplace.

func (DataFrame) Tail

func (df DataFrame) Tail(n ...int) DataFrame

Tail returns a slice of the last n elements of the DataFrame. If n is not specified, it defaults to 5.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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