df

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

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

Bool is an alias for string to be able to implement custom methods

func (Bool) Bool

func (b Bool) Bool() (*bool, error)

Bool returns the bool value of Bool

func (Bool) Checksum

func (b Bool) Checksum() [16]byte

Checksum generates a pseudo-unique 16 byte array

func (Bool) Copy added in v0.4.0

func (b Bool) Copy() Cell

Copy returns a copy of a given Cell

func (Bool) Float

func (b Bool) Float() (*float64, error)

Float returns the float value of Bool

func (Bool) Int

func (b Bool) Int() (*int, error)

Int returns the integer value of Bool

func (Bool) IsNA added in v0.4.0

func (b Bool) IsNA() bool

IsNA returns true if the element is empty and viceversa

func (Bool) NA

func (b Bool) NA() Cell

NA returns the empty element for this type

func (Bool) String

func (b Bool) String() string

type C

type C struct {
	Colname  string
	Elements Cells
}

C represents a way to pass Colname and Elements to a DF constructor

type Cell added in v0.4.0

type Cell interface {
	String() string
	Int() (*int, error)
	Float() (*float64, error)
	Bool() (*bool, error)
	NA() Cell
	IsNA() bool
	Checksum() [16]byte
	Copy() Cell
}

Cell is the interface that every cell in a DataFrame needs to comply with

type Cells added in v0.4.0

type Cells []Cell

Cells is a wrapper for a slice of Cells

func Bools

func Bools(args ...interface{}) Cells

Bools is a constructor for a bools array

func Floats

func Floats(args ...interface{}) Cells

Floats is a constructor for a Float array

func Ints

func Ints(args ...interface{}) Cells

Ints is a constructor for an Int array

func Strings

func Strings(args ...interface{}) Cells

Strings is a constructor for a String array

type DataFrame

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

DataFrame is the base data structure

func Cbind

func Cbind(a DataFrame, b DataFrame) (*DataFrame, error)

Cbind combines the columns of two DataFrames

func CrossJoin added in v0.4.0

func CrossJoin(a DataFrame, b DataFrame) (*DataFrame, error)

CrossJoin returns a DataFrame containing the cartesian product of the rows on both DataFrames.

func InnerJoin added in v0.4.0

func InnerJoin(a DataFrame, b DataFrame, keys ...string) (*DataFrame, error)

InnerJoin returns a DataFrame containing the inner join of two other DataFrames. This operation matches all rows that appear on both dataframes.

func LeftJoin added in v0.4.0

func LeftJoin(a DataFrame, b DataFrame, keys ...string) (*DataFrame, error)

LeftJoin returns a DataFrame containing the left join of two other DataFrames. This operation matches all rows that appear on the left DataFrame and matches it with the existing ones on the right one, filling the missing rows on the right with an empty value.

func New

func New(colConst ...C) (*DataFrame, error)

New is a constructor for DataFrames

func Rbind

func Rbind(a DataFrame, b DataFrame) (*DataFrame, error)

Rbind combines the rows of two dataframes

func RightJoin added in v0.4.0

func RightJoin(b DataFrame, a DataFrame, keys ...string) (*DataFrame, error)

RightJoin returns a DataFrame containing the right join of two other DataFrames. This operation matches all rows that appear on the right DataFrame and matches it with the existing ones on the left one, filling the missing rows on the left with an empty value.

func (DataFrame) Dim

func (df DataFrame) Dim() (dim [2]int)

Dim will return the current dimensions of the DataFrame in a two element array where the first element is the number of rows and the second the number of columns.

func (DataFrame) Duplicated

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

Duplicated will return the first appearance of the duplicated rows in a DataFrame. The order of the rows will not be preserved.

func (*DataFrame) LoadAndParse

func (df *DataFrame) LoadAndParse(records [][]string, types interface{}) error

LoadAndParse will load the data from a multidimensional array of strings and parse it accordingly with the given types element. The types element can be a string array with matching dimensions to the number of columns or a DataFrame.T object.

func (*DataFrame) LoadData

func (df *DataFrame) LoadData(records [][]string) error

LoadData will load the data from a multidimensional array of strings into a DataFrame object.

func (DataFrame) NCols added in v0.4.0

func (df DataFrame) NCols() int

NCols is the getter method for the number of rows in a DataFrame

func (DataFrame) NRows added in v0.4.0

func (df DataFrame) NRows() int

NRows is the getter method for the number of rows in a DataFrame

func (DataFrame) Names

func (df DataFrame) Names() []string

Names is the getter method for the column names

func (DataFrame) RemoveDuplicated

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

RemoveDuplicated will return all unique rows in a DataFrame and the first appearance of all duplicated rows. The order of the rows will not be preserved.

func (DataFrame) RemoveUnique

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

RemoveUnique will return all duplicated rows inside a DataFrame

func (DataFrame) SaveRecords

func (df DataFrame) SaveRecords() [][]string

SaveRecords will save data to records in [][]string format

func (*DataFrame) SetNames

func (df *DataFrame) SetNames(colnames []string) error

SetNames let us specify the column names of a DataFrame

func (DataFrame) String

func (df DataFrame) String() (str string)

Implementing the Stringer interface for DataFrame

func (DataFrame) Subset

func (df DataFrame) Subset(subsetCols interface{}, subsetRows interface{}) (*DataFrame, error)

Subset will return a DataFrame that contains only the columns and rows contained on the given subset

func (DataFrame) SubsetColumns

func (df DataFrame) SubsetColumns(subset interface{}) (*DataFrame, error)

SubsetColumns will return a DataFrame that contains only the columns contained on the given subset

func (DataFrame) SubsetRows

func (df DataFrame) SubsetRows(subset interface{}) (*DataFrame, error)

SubsetRows will return a DataFrame that contains only the selected rows

func (DataFrame) Unique

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

Unique will return all unique rows inside a DataFrame. The order of the rows will not be preserved.

type Float

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

Float is an alias for float64 to be able to implement custom methods

func (Float) Bool

func (f Float) Bool() (*bool, error)

Bool returns the bool value of Float

func (Float) Checksum

func (f Float) Checksum() [16]byte

Checksum generates a pseudo-unique 16 byte array

func (Float) Copy added in v0.4.0

func (f Float) Copy() Cell

Copy returns a copy of a given Cell

func (Float) Float

func (f Float) Float() (*float64, error)

Float returns the float value of Float

func (Float) Int

func (f Float) Int() (*int, error)

Int returns the integer value of Float

func (Float) IsNA added in v0.4.0

func (f Float) IsNA() bool

IsNA returns true if the element is empty and viceversa

func (Float) NA

func (f Float) NA() Cell

NA returns the empty element for this type

func (Float) String

func (f Float) String() string

type Int

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

Int is an alias for int to be able to implement custom methods

func (Int) Bool

func (i Int) Bool() (*bool, error)

Bool returns the bool value of Int

func (Int) Checksum

func (i Int) Checksum() [16]byte

Checksum generates a pseudo-unique 16 byte array

func (Int) Copy added in v0.4.0

func (i Int) Copy() Cell

Copy returns a copy of a given Cell

func (Int) Float

func (i Int) Float() (*float64, error)

Float returns the float value of Int

func (Int) Int

func (i Int) Int() (*int, error)

Int returns the integer value of Int

func (Int) IsNA added in v0.4.0

func (i Int) IsNA() bool

IsNA returns true if the element is empty and viceversa

func (Int) NA

func (i Int) NA() Cell

NA returns the empty element for this type

func (Int) String

func (i Int) String() string

type R

type R struct {
	From int
	To   int
}

R represent a range from a number to another

type String

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

String is an alias for string to be able to implement custom methods

func (String) Bool

func (s String) Bool() (*bool, error)

Bool returns the bool value of String

func (String) Checksum

func (s String) Checksum() [16]byte

Checksum generates a pseudo-unique 16 byte array

func (String) Copy added in v0.4.0

func (s String) Copy() Cell

Copy returns a copy of a given Cell

func (String) Float

func (s String) Float() (*float64, error)

Float returns the float value of String

func (String) Int

func (s String) Int() (*int, error)

Int returns the integer value of String

func (String) IsNA added in v0.4.0

func (s String) IsNA() bool

IsNA returns true if the element is empty and viceversa

func (String) NA

func (s String) NA() Cell

NA returns the empty element for this type

func (String) String

func (s String) String() string

type T

type T map[string]string

T is used to represent the association between a column and it't type

Jump to

Keyboard shortcuts

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