Documentation ¶
Index ¶
- type Dataframe
- func (d *Dataframe) AddColumn(name, null string)
- func (d *Dataframe) AddRow(row []string) error
- func (d *Dataframe) Clone() *Dataframe
- func (d *Dataframe) Compare(n *Dataframe) error
- func (d *Dataframe) Copy() *Dataframe
- func (d *Dataframe) DeleteColumn(col interface{}) error
- func (d *Dataframe) DeleteRow(idx interface{}) error
- func (d *Dataframe) Dimensions() (int, int)
- func (d *Dataframe) Extend(n *Dataframe) error
- func (d *Dataframe) FormatHeader(sep string) string
- func (d *Dataframe) GetCell(idx interface{}, col interface{}) (string, error)
- func (d *Dataframe) GetCellFloat(idx interface{}, col interface{}) (float64, error)
- func (d *Dataframe) GetCellInt(idx interface{}, col interface{}) (int, error)
- func (d *Dataframe) GetColumn(col interface{}) ([]string, error)
- func (d *Dataframe) GetColumnUnique(col interface{}) ([]string, error)
- func (d *Dataframe) GetHeader() []string
- func (d *Dataframe) GetIndex() []string
- func (d *Dataframe) GetMetaData() string
- func (d *Dataframe) GetRow(idx interface{}) ([]string, error)
- func (d *Dataframe) Iterate() <-chan *Series
- func (d *Dataframe) Length() int
- func (d *Dataframe) Print()
- func (d *Dataframe) RenameColumn(o, n string) error
- func (d *Dataframe) RenameRow(o, n string) error
- func (d *Dataframe) SetHeader(row []string) error
- func (d *Dataframe) SetMetaData(v string)
- func (d *Dataframe) SliceRow(idx interface{}, start interface{}, end interface{}) ([]string, error)
- func (d *Dataframe) ToCSV(outfile string)
- func (d *Dataframe) ToSeries(idx interface{}) *Series
- func (d *Dataframe) ToSlice() [][]string
- func (d *Dataframe) UpdateCell(idx interface{}, col interface{}, v string) error
- type Series
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dataframe ¶
type Dataframe struct { Header map[string]int Index map[string]int Rows [][]string // contains filtered or unexported fields }
Dataframe stores data as a two-dimensional string slice with header and index as maps or named indeces.
func FromFile ¶
FromFile creates a dataframe and loads in data from the given input file. The first row is assumed to be the header.
func FromSlice ¶
FromSlice creates a new dataframe and loads data from the given slice. The first row is assumed to be the header.
func NewDataFrame ¶
NewDataFrame returns an empty dataframe struct.
func (*Dataframe) AddColumn ¶
AddColumn adds a new column with the given name to the end of the dataframe and stores the given null value in each row.
func (*Dataframe) AddRow ¶
AddRow adds a string slice to dataframe and stores the index value in Index if using.
func (*Dataframe) Clone ¶
Clone returns a copy of the dataframe's structure. Specifically, it returns an empty dataframe with the same header and index column name.
func (*Dataframe) Compare ¶
Compare returns an error if target dataframe is not equal to d (for testing).
func (*Dataframe) DeleteColumn ¶
DeleteColumn removes the given column from dataframe.
func (*Dataframe) Dimensions ¶
Dimensions returns row and column lengths (respectively).
func (*Dataframe) Extend ¶
Extend appends rows from n to the current dataframe. Rows with redundant index values will be skipped.
func (*Dataframe) FormatHeader ¶
FormatHeader formats header for writing. Prepends index name if needed.
func (*Dataframe) GetCellFloat ¶
GetCellFloat returns the value of the given cell as float64. Returns an error if it cannot be converted.
func (*Dataframe) GetCellInt ¶
GetCellInt returns the value of the given cell as int. Returns an error if it cannot be converted.
func (*Dataframe) GetColumnUnique ¶
GetColumnUnique returns all unique values from the given column.
func (*Dataframe) RenameColumn ¶
RenameColumn changes the name of column o to n. Returns an error if o is not found.
func (*Dataframe) RenameRow ¶
RenameRow changes the name of row o to n. Returns an error if o is not found.
func (*Dataframe) SliceRow ¶
SliceRow returns a slice of the given row between start and end (not including the value at end).
func (*Dataframe) ToSlice ¶
ToSlice returns dataframe as a two-dimensional string slice (inserts index values if needed but does not include header).
func (*Dataframe) UpdateCell ¶
UpdateCell replaces the value in a given cell with v.
type Series ¶
type Series struct { // Encapsulates error so it can be returned through channel Error error // Same as dataframe header Header map[string]int // Interger index of row in Rows slice Index int // Name of row if index map is set Name string // Copy of row from dataframe at index Row []string // contains filtered or unexported fields }
func (*Series) GetCellFloat ¶
GetCellFloat returns the value of the given cell as float64. Returns an error if it cannot be converted.
func (*Series) GetCellInt ¶
GetCellInt returns the value of the given cell as int. Returns an error if it cannot be converted.
func (*Series) UpdateCell ¶
UpdateCell updates col to val. Returns error if column name is not in header.