dataframe

package module
v0.0.0-...-246eff5 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2013 License: BSD-3-Clause Imports: 8 Imported by: 1

README

dataframe

This is an experimental package, please post feedback at the gonum forum.

A package to manage R-like data frames written in Go.

Installation

$ go get github.com/akualab/dataframe

Documentation: godoc.org/github.com/akualab/dataframe

For an example, visit the example sub-directory.

Documentation

Overview

A package to manage R-like data frames.

DataFrame

A DataFrame is a table where columns are variables and rows are measurements. For example:

row    room      wifi                     acceleration
0      KITCHEN   [-56.1, -78.9, -44.12]   1.3
1      BATH      [-58, -71.1, -39.8]      1.8
...

Each column correspond to a variable. Each variable can have a different type. In this case, room is a string, wifi is an array of numbers, and acceleration is a number. In JSON:

{
  "description": "An indoor positioning data set.",
  "batchid": "24001-015",
  "var_names": ["room", "wifi", "acceleration"],
  "properties": {"url": "http://akualab.com", "status": "experimental"},
  "data": [
    ["KITCHEN", [-56.1, -78.9, -44.12], 1.3],
    ["BATH"   , [-58, -71.1, -39.8],    1.8]
  ]
}

DataSet

A DataSet is a collection of DataFrame files. All files must have the same schema. The API provides methods to iterate over the DataSet which hides teh details about files from the end user.

Index

Constants

View Source
const (
	BUFFER_SIZE = 1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataFrame

type DataFrame struct {

	// Describes the data.
	Description string `json:"description"`

	// Identifies the batch or data. For example: a session, a file, etc.
	BatchID string `json:"batchid"`

	// Ordered list of variable names.
	VarNames []string `json:"var_names"`

	// Ordered list of variables.
	Data [][]interface{} `json:"data"`

	// Can be used to store custom properties related to the data frame.
	Properties map[string]string `json:"properties"`
	// contains filtered or unexported fields
}

A DataFrame is a table where columns are variables and rows are measurements. Each row contains an instance. Each variable can have a different type.

func ReadDataFrame

func ReadDataFrame(r io.Reader) (df *DataFrame, e error)

Reads features from io.Reader.

func ReadDataFrameFile

func ReadDataFrameFile(fn string) (df *DataFrame, e error)

Reads feature from file.

func (*DataFrame) Float64Slice

func (df *DataFrame) Float64Slice(frame int, names ...string) (floats []float64, err error)

Joins float64 and []float64 variables and returns them as a []float64.

func (*DataFrame) Float64SliceChannel

func (df *DataFrame) Float64SliceChannel(names ...string) (ch chan []float64)

Joins float64 and []float64 variables. Returns a channel of []float64 frames.

func (*DataFrame) N

func (df *DataFrame) N() int

Returns number of data instances (rows) in data frame.

func (*DataFrame) NumVariables

func (df *DataFrame) NumVariables() int

Returns number of variables (columns) in data frame.

func (*DataFrame) String

func (df *DataFrame) String(frame int, name string) (value string, err error)

Returns value of a string variable.

type DataSet

type DataSet struct {
	Path  string   `yaml:"path"`
	Files []string `yaml:"files"`
	// contains filtered or unexported fields
}

A list of dataframe files. Each file must have the same dataframe schema.

func ReadDataSet

func ReadDataSet(r io.Reader) (ds *DataSet, e error)

Reads a list of filenames from an io.Reader.

func ReadDataSetFile

func ReadDataSetFile(fn string) (ds *DataSet, e error)

Reads a list of filenames from a file. See ReadDataSetReader()

func (*DataSet) Float64SliceChannel

func (ds *DataSet) Float64SliceChannel(names ...string) (ch chan []float64)

Resets data set and starts reading data. Returns a channel to be used to get all the frames.

func (*DataSet) Next

func (ds *DataSet) Next() (df *DataFrame, e error)

Reads attributes from the next file in the data set. The error returns io.EOF when no more files are available.

func (*DataSet) Reset

func (ds *DataSet) Reset()

Go back to the beginning of the data set.

Directories

Path Synopsis
Example program that uses the dataframe package.
Example program that uses the dataframe package.

Jump to

Keyboard shortcuts

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