Documentation
¶
Index ¶
- Constants
- type Aggregation
- type AggregationType
- type DataFrame
- func (df DataFrame) Arrange(order ...Order) DataFrame
- func (df DataFrame) CBind(dfb DataFrame) DataFrame
- func (df DataFrame) Capply(f func(series.Serie) series.Serie) DataFrame
- func (df DataFrame) Col(colname string) series.Serie
- func (df DataFrame) Concat(dfb DataFrame) DataFrame
- func (df DataFrame) Copy() DataFrame
- func (df DataFrame) CrossJoin(b DataFrame) DataFrame
- func (df DataFrame) Describe() DataFrame
- func (df DataFrame) Dims() (int, int)
- func (df DataFrame) Drop(indexes SelectIndexes) DataFrame
- func (df DataFrame) Elem(r, c int) series.Element
- func (df *DataFrame) Error() error
- func (df DataFrame) Filter(filters ...F) DataFrame
- func (df DataFrame) FilterAggregation(agg Aggregation, filters ...F) DataFrame
- func (df DataFrame) GroupBy(colnames ...string) *Groups
- func (df DataFrame) InnerJoin(b DataFrame, keys ...string) DataFrame
- func (df DataFrame) LeftJoin(b DataFrame, keys ...string) DataFrame
- func (df DataFrame) Maps() []map[string]interface{}
- func (df DataFrame) Mutate(s series.Serie) DataFrame
- func (df DataFrame) Names() []string
- func (df DataFrame) Ncol() int
- func (df DataFrame) Nrow() int
- func (df DataFrame) OuterJoin(b DataFrame, keys ...string) DataFrame
- func (df DataFrame) RBind(dfb DataFrame) DataFrame
- func (df DataFrame) Rapply(f func(series.Serie) series.Serie) DataFrame
- func (df DataFrame) Records() [][]string
- func (df DataFrame) Rename(newname, oldname string) DataFrame
- func (df DataFrame) RightJoin(b DataFrame, keys ...string) DataFrame
- func (df DataFrame) Select(indexes SelectIndexes) DataFrame
- func (df DataFrame) Set(indexes series.Indexes, newvalues DataFrame) DataFrame
- func (df DataFrame) SetNames(colnames ...string) error
- func (df DataFrame) String() (str string)
- func (df DataFrame) Subset(indexes series.Indexes) DataFrame
- func (df DataFrame) Types() []series.ElementType
- type F
- type Groups
- type LoadOption
- func DefaultType(t series.ElementType) LoadOption
- func DetectTypes(b bool) LoadOption
- func HasHeader(b bool) LoadOption
- func NaNValues(nanValues []string) LoadOption
- func Names(names ...string) LoadOption
- func WithComments(b rune) LoadOption
- func WithDelimiter(b rune) LoadOption
- func WithLazyQuotes(b bool) LoadOption
- func WithTypes(coltypes map[string]series.ElementType) LoadOption
- type Matrix
- type Order
- type SelectIndexes
- type Writer
Constants ¶
const KEY_ERROR = "KEY_ERROR"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregation ¶
type Aggregation int
Aggregation defines the filter aggregation
const ( // Or aggregates filters with logical or Or Aggregation = iota // And aggregates filters with logical and And )
func (Aggregation) String ¶
func (a Aggregation) String() string
type AggregationType ¶
type AggregationType int
AggregationType Aggregation method type
const ( Aggregation_MAX AggregationType = iota + 1 // MAX Aggregation_MIN // MIN Aggregation_MEAN // MEAN Aggregation_MEDIAN // MEDIAN Aggregation_STD // STD Aggregation_SUM // SUM Aggregation_COUNT // COUNT )
func (AggregationType) String ¶
func (i AggregationType) String() string
type DataFrame ¶
type DataFrame struct { // deprecated: Use Error() instead Err error // contains filtered or unexported fields }
DataFrame is a data structure designed for operating on table like data (Such as Excel, CSV files, SQL table results...) where every column have to keep type integrity. As a general rule of thumb, variables are stored on columns where every row of a DataFrame represents an observation for each variable.
On the real world, data is very messy and sometimes there are non measurements or missing data. For this reason, DataFrame has support for NaN elements and allows the most common data cleaning and mungling operations such as subsetting, filtering, type transformations, etc. In addition to this, this library provides the necessary functions to concatenate DataFrames (By rows or columns), different Join operations (Inner, Outer, Left, Right, Cross) and the ability to read and write from different formats (CSV/JSON).
func LoadMaps ¶
func LoadMaps(maps []map[string]interface{}, options ...LoadOption) DataFrame
LoadMaps creates a new DataFrame based on the given maps. This function assumes that every map on the array represents a row of observations.
func LoadRecords ¶
func LoadRecords(records [][]string, options ...LoadOption) DataFrame
LoadRecords creates a new DataFrame based on the given records.
func (DataFrame) Col ¶
Col returns a copy of the Series with the given column name contained in the DataFrame.
func (DataFrame) Concat ¶
Concat concatenates rows of two DataFrames like RBind, but also including unmatched columns.
func (DataFrame) CrossJoin ¶
CrossJoin returns a DataFrame containing the cross join of two DataFrames.
func (DataFrame) Drop ¶
func (df DataFrame) Drop(indexes SelectIndexes) DataFrame
Drop the given DataFrame columns
func (DataFrame) Elem ¶
Elem returns the element on row `r` and column `c`. Will panic if the index is out of bounds.
func (DataFrame) Filter ¶
Filter will filter the rows of a DataFrame based on the given filters. All filters on the argument of a Filter call are aggregated as an OR operation whereas if we chain Filter calls, every filter will act as an AND operation with regards to the rest.
func (DataFrame) FilterAggregation ¶
func (df DataFrame) FilterAggregation(agg Aggregation, filters ...F) DataFrame
FilterAggregation will filter the rows of a DataFrame based on the given filters. All filters on the argument of a Filter call are aggregated depending on the supplied aggregation.
func (DataFrame) InnerJoin ¶
InnerJoin returns a DataFrame containing the inner join of two DataFrames.
func (DataFrame) LeftJoin ¶
LeftJoin returns a DataFrame containing the left join of two DataFrames.
func (DataFrame) Mutate ¶
Mutate changes a column of the DataFrame with the given Series or adds it as a new column if the column name does not exist.
func (DataFrame) OuterJoin ¶
OuterJoin returns a DataFrame containing the outer join of two DataFrames.
func (DataFrame) RBind ¶
RBind matches the column names of two DataFrames and returns combined rows from both of them.
func (DataFrame) Rapply ¶
Rapply applies the given function to the rows of a DataFrame. Prior to applying the function the elements of each row are cast to a Series of a specific type. In order of priority: String -> Float -> Int -> Bool. This casting also takes place after the function application to equalize the type of the columns.
func (DataFrame) RightJoin ¶
RightJoin returns a DataFrame containing the right join of two DataFrames.
func (DataFrame) Select ¶
func (df DataFrame) Select(indexes SelectIndexes) DataFrame
Select the given DataFrame columns
func (DataFrame) SetNames ¶
SetNames changes the column names of a DataFrame to the ones passed as an argument.
func (DataFrame) Subset ¶
Subset returns a subset of the rows of the original DataFrame based on the Series subsetting indexes.
func (DataFrame) Types ¶
func (df DataFrame) Types() []series.ElementType
Types returns the types of the columns on a DataFrame.
type F ¶
type F struct { Colidx int Colname string Comparator series.Comparator Comparando interface{} }
F is the filtering structure
type Groups ¶
type Groups struct { Err error // contains filtered or unexported fields }
Groups : structure generated by groupby
func (Groups) Aggregation ¶
func (gps Groups) Aggregation(typs []AggregationType, colnames []string) DataFrame
Aggregation :Aggregate dataframe by aggregation type and aggregation column name
type LoadOption ¶
type LoadOption func(*loadOptions)
LoadOption is the type used to configure the load of elements
func DefaultType ¶
func DefaultType(t series.ElementType) LoadOption
DefaultType sets the defaultType option for loadOptions.
func DetectTypes ¶
func DetectTypes(b bool) LoadOption
DetectTypes sets the detectTypes option for loadOptions.
func HasHeader ¶
func HasHeader(b bool) LoadOption
HasHeader sets the hasHeader option for loadOptions.
func NaNValues ¶
func NaNValues(nanValues []string) LoadOption
NaNValues sets the nanValues option for loadOptions.
func WithComments ¶
func WithComments(b rune) LoadOption
WithComments sets the csv comment line detect to remove lines
func WithDelimiter ¶
func WithDelimiter(b rune) LoadOption
WithDelimiter sets the csv delimiter other than ',', for example '\t'
func WithLazyQuotes ¶
func WithLazyQuotes(b bool) LoadOption
WithLazyQuotes sets csv parsing option to LazyQuotes
func WithTypes ¶
func WithTypes(coltypes map[string]series.ElementType) LoadOption
WithTypes sets the types option for loadOptions.
type Order ¶
Order is the ordering structure
type SelectIndexes ¶
type SelectIndexes any
SelectIndexes are the supported indexes used for the DataFrame.Select method. Currently supported are:
int // Matches the given index number []int // Matches all given index numbers []bool // Matches all columns marked as true string // Matches the column with the matching column name []string // Matches all columns with the matching column names Series [Int] // Same as []int Series [Bool] // Same as []bool Series [String] // Same as []string